Skip to contents

Creates a new H5ClusterRun object, representing a single run of full voxel-level clustered data from an HDF5 file.

This function handles file opening/closing and reads necessary metadata like n_time from the HDF5 file if not provided explicitly.

Usage

H5ClusterRun(file, scan_name, mask, clusters, n_time = NULL, compress = FALSE)

Arguments

file

Character string path to the HDF5 file.

scan_name

The character string name of the scan (e.g., "run1").

mask

A LogicalNeuroVol object for the brain mask.

clusters

A ClusteredNeuroVol object for cluster assignments.

n_time

(Optional) The number of time points. If NULL (default), the function will attempt to read it from the HDF5 file attributes or metadata dataset.

compress

(Optional) Logical indicating compression status (metadata).

Value

A new H5ClusterRun object with an open file handle managed by the object.

Details

Diagnostic messages (such as when n_time is inferred from a dataset) are printed only when the option fmristore.verbose is set to TRUE via options(fmristore.verbose = TRUE).

Examples

if (FALSE) { # \dontrun{
# Create temporary HDF5 file with minimal experiment structure
temp_file <- tempfile(fileext = ".h5")
exp_file <- fmristore:::create_minimal_h5_for_H5ClusterExperiment(file_path = temp_file)

# Create mask and clusters
mask <- fmristore:::create_minimal_LogicalNeuroVol(dims = c(5, 5, 4))
clusters <- fmristore:::create_minimal_ClusteredNeuroVol(mask_vol = mask, num_clusters = 3)

# Create H5ClusterRun object
run <- H5ClusterRun(exp_file, scan_name = "Run1_Full", mask = mask, clusters = clusters)

# Access properties
print(run@n_time)
print(dim(mask))

# Clean up
close(run)
unlink(temp_file)
} # }