Skip to contents

Represents a collection of clustered neuroimaging runs (scans) stored within a single HDF5 file. It acts as a container for `H5ClusterRun` and/or `H5ClusterRunSummary` objects, along with associated metadata.

This class facilitates managing multiple runs that share the same mask and cluster definitions.

Slots

runs

A `list` where each element is an object inheriting from `H5ClusteredArray` (typically `H5ClusterRun` or `H5ClusterRunSummary`).

scan_metadata

A `list` containing metadata for each scan in the `runs` list.

cluster_metadata

A `data.frame` containing metadata associated with the clusters.

Examples

if (FALSE) { # \dontrun{
if (requireNamespace("neuroim2", quietly = TRUE) &&
    requireNamespace("hdf5r", quietly = TRUE) &&
    exists("H5ClusterExperiment", where = "package:fmristore") &&
    !is.null(fmristore:::create_minimal_h5_for_H5ClusterExperiment)) {

  temp_exp_file <- NULL
  exp <- NULL
  tryCatch({
    # 1. Create an HDF5 file for an experiment containing runs
    temp_exp_file <- fmristore:::create_minimal_h5_for_H5ClusterExperiment()

    # 2. Load the experiment using the constructor
    exp <- fmristore::H5ClusterExperiment(file_path = temp_exp_file)

    # 3. Show the experiment object
    print(exp)
    print(names(runs(exp))) # Show the names of the runs it loaded

  }, error = function(e) {
    message("H5ClusterExperiment example failed: ", e$message)
  }, finally = {
    # Close H5ClusterExperiment handle (closes underlying file)
    if (!is.null(exp)) try(close(exp), silent = TRUE)
    # Cleanup temporary file
    if (!is.null(temp_exp_file) && file.exists(temp_exp_file)) {
      unlink(temp_exp_file)
    }
  })
} else {
  message("Skipping H5ClusterExperiment example: dependencies or helper not available.")
}
} # }