A class representing a four-dimensional brain image backed by an HDF5 file.
H5NeuroVec
objects provide efficient storage and access for large-scale
4D neuroimaging data using the HDF5 file format.
Details
H5NeuroVec
inherits a space
slot from
NeuroVec-class
, defining the 4D dimensions
(e.g., x
, y
, z
, time
). Data are stored in an HDF5
dataset and accessed on demand.
Slots
obj
An instance of class
H5File
from the hdf5r package, representing the underlying HDF5 file containing the 4D brain image data.
Inheritance
H5NeuroVec
inherits from:
NeuroVec-class
: Base class for 4D brain imagesArrayLike4D-class
: Interface for 4D array-like operations
See also
NeuroVec-class
for the base 4D brain image class.
H5NeuroVol-class
for the 3D counterpart.
H5File
for details on HDF5 file objects.
Examples
if (FALSE) { # \dontrun{
if (requireNamespace("neuroim2", quietly = TRUE) &&
requireNamespace("hdf5r", quietly = TRUE) &&
exists("H5NeuroVec", where = "package:fmristore") &&
!is.null(fmristore:::create_minimal_h5_for_H5NeuroVec)) {
# Setup: Create a temporary HDF5 file using a helper
temp_h5_path <- NULL
h5_vec <- NULL
tryCatch({
temp_h5_path <- fmristore:::create_minimal_h5_for_H5NeuroVec(dims = c(5L, 5L, 3L, 4L))
# Create an H5NeuroVec object using the constructor
# Constructor defaults: dataset_name = "data/elements", space from HDF5 /space group
h5_vec <- fmristore::H5NeuroVec(file_name = temp_h5_path)
print(h5_vec)
# Access a subset of the data
subset_data <- h5_vec[1:2, 1:2, 1, 1:2]
print(subset_data)
}, error = function(e) {
message("H5NeuroVec example failed: ", e$message)
}, finally = {
# Close HDF5 handle owned by H5NeuroVec object
if (!is.null(h5_vec) && inherits(h5_vec, "H5NeuroVec")) {
try(close(h5_vec), silent = TRUE)
}
# Cleanup temporary file
if (!is.null(temp_h5_path) && file.exists(temp_h5_path)) {
unlink(temp_h5_path)
}
})
} else {
message("Skipping H5NeuroVec example: fmristore, neuroim2, hdf5r, or helper not available.")
}
} # }