Skip to contents

Constructs an H5NeuroVec object, which represents a 4D brain image stored in an HDF5 file. The HDF5 file is opened explicitly in read-only mode using hdf5r::H5File$new(file_name, mode = "r").

Usage

H5NeuroVec(file_name)

Arguments

file_name

The path to an existing 4D HDF5 neuroimaging file.

Value

A new H5NeuroVec-class instance with an open HDF5 file handle.

Details

This constructor is used for reading existing HDF5 files that conform to the H5NeuroVec specification (typically created via as_h5("NeuroVec", ...)).

Lifecycle Management

When an H5NeuroVec object is created by providing a file_name, it opens the specified HDF5 file and maintains an open handle to it. **It is the user's responsibility to explicitly close this handle** when the object is no longer needed to release system resources. This can be done by calling close(your_h5neurovec_object).

Failure to close the handle may lead to issues such as reaching file handle limits or problems with subsequent access to the file.

See also

close for closing the file handle, NeuroVec-class

Examples

if (FALSE) { # \dontrun{
# Assuming "my_vec.h5" is a valid H5NeuroVec HDF5 file
h5vec <- H5NeuroVec("my_vec.h5")
# ... perform operations with h5vec ...
print(dim(h5vec))
# Important: Close the handle when done
close(h5vec)
} # }