This generic returns any available metadata associated with clusters in an object.
Examples
if (FALSE) { # \dontrun{
if (requireNamespace("neuroim2", quietly = TRUE) &&
requireNamespace("hdf5r", quietly = TRUE) &&
exists("H5ClusterExperiment", where = "package:fmristore") &&
exists("cluster_metadata", where = "package:fmristore") &&
!is.null(fmristore:::create_minimal_h5_for_H5ClusterExperiment)) {
temp_exp_file <- NULL
exp_obj <- NULL
tryCatch({
# Create a minimal H5ClusterExperiment
temp_exp_file <- fmristore:::create_minimal_h5_for_H5ClusterExperiment()
exp_obj <- fmristore::H5ClusterExperiment(file_path = temp_exp_file)
# Get the cluster metadata
c_meta <- cluster_metadata(exp_obj)
print(c_meta)
# The helper currently doesn't add rich cluster_metadata,
# so this is likely an empty data.frame or one with default cluster names/IDs.
}, error = function(e) {
message("cluster_metadata 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 cluster_metadata example: dependencies or helper not available.")
}
} # }