Concatenate Cluster Summary Matrices Across Runs (Generic)
Source:R/all_generic.R
, R/cluster_experiment.R
matrix_concat.Rd
Concatenate Cluster Summary Matrices Across Runs (Generic)
Usage
matrix_concat(experiment, run_indices = NULL, ...)
# S4 method for class 'H5ParcellatedMultiScan'
matrix_concat(experiment, run_indices = NULL)
Arguments
- experiment
The experiment object (typically
H5ParcellatedMultiScan-class
).- run_indices
Optional: A numeric or character vector specifying which runs to include. If NULL, uses all runs that are of summary type or can produce a summary matrix.
- ...
Additional arguments for methods.
Methods (by class)
matrix_concat(H5ParcellatedMultiScan)
: Concatenate summary matrices for H5ParcellatedMultiScan
See also
Other H5Parcellated:
$,H5ParcellatedMultiScan-method
,
H5ParcellatedArray-class
,
H5ParcellatedMultiScan
,
H5ParcellatedScan-class
,
H5ParcellatedScanSummary-class
,
close()
,
cluster_metadata,H5ParcellatedMultiScan-method
,
clusters()
,
h5file,H5ParcellatedArray-method
,
mask()
,
n_scans,H5ParcellatedMultiScan-method
,
scan_metadata,H5ParcellatedMultiScan-method
,
scan_names,H5ParcellatedMultiScan-method
,
series_concat()
Examples
if (FALSE) { # \dontrun{
if (!is.null(fmristore:::create_minimal_h5_for_H5ParcellatedMultiScan)) {
temp_exp_file <- NULL
exp_obj <- NULL
tryCatch({
temp_exp_file <- fmristore:::create_minimal_h5_for_H5ParcellatedMultiScan(
n_time_run2 = 6L # Shorter time series for Run2_Summary
)
exp_obj <- fmristore::H5ParcellatedMultiScan(file_path = temp_exp_file)
# Note: matrix_concat typically works on runs with summary data (H5ParcellatedScanSummary)
# The helper creates "Run2_Summary".
# concatenated_matrix <- matrix_concat(exp_obj, run_indices = "Run2_Summary")
# print(dim(concatenated_matrix))
# Should be n_time_run2 x n_master_clusters (e.g., 6x3 if num_master_clusters is 3)
# print(head(concatenated_matrix))
# The method should correctly identify and use the summary run.
# If only one summary run is present, run_indices can often be omitted.
conc_matrix <- matrix_concat(exp_obj, run_indices = "Run2_Summary")
print(paste("Dimensions of concatenated matrix from Run2_Summary:",
paste(dim(conc_matrix), collapse="x")))
# Example with all compatible runs (should pick up Run2_Summary)
# conc_matrix_all <- matrix_concat(exp_obj)
# print(paste("Dimensions of concatenated matrix from all compatible runs:",
# paste(dim(conc_matrix_all), collapse="x")))
}, error = function(e) {
message("matrix_concat example failed: ", e$message)
}, finally = {
if (!is.null(exp_obj)) try(close(exp_obj), silent = TRUE)
if (!is.null(temp_exp_file) && file.exists(temp_exp_file)) {
unlink(temp_exp_file)
}
})
} else {
message("Skipping matrix_concat example: helper not available.")
}
} # }