ModelArray class
ModelArray.RdA ModelArray wraps one or more element-wise scalar matrices (e.g., FD, FC, log_FC for fixel data) read lazily via DelayedArray, along with any previously saved analysis results. The object holds references to the underlying HDF5 file and reads data on demand, making it suitable for large-scale neuroimaging datasets.
Reads scalar matrices and (optionally) saved analysis results from an HDF5 file and returns a ModelArray object.
Arguments
- filepath
Character. Path to an existing HDF5 (
.h5) file containing element-wise scalar data.- scalar_types
Character vector. Names of scalar groups to read from
/scalars/in the HDF5 file. Default isc("FD"). Must match group names in the file; verify withrhdf5::h5ls(filepath).- analysis_names
Character vector. Subfolder names under
/results/to load. Default ischaracter(0)(no results loaded).
Details
ModelArray is an S4 class that represents element-wise scalar data and associated statistical results backed by an HDF5 file on disk.
Each scalar in the HDF5 file is stored at /scalars/<name>/values
as a matrix of elements (rows) by source files (columns). Source filenames
are read from HDF5 attributes or companion datasets. Analysis results, if
present, live under /results/<analysis_name>/results_matrix.
ModelArray objects are typically created with the ModelArray
constructor function. Element-wise models are fit with
ModelArray.lm, ModelArray.gam, or
ModelArray.wrap.
The constructor reads each scalar listed in scalar_types from
/scalars/<scalar_type>/values in the HDF5 file, wrapping them as
DelayedArray objects for lazy access. Source filenames are
extracted from HDF5 attributes or companion datasets.
If analysis_names is non-empty, saved results are read from
/results/<name>/results_matrix along with column name metadata.
Debugging tip: If you encounter
"Error in h(simpleError(msg, call)) : error in evaluating the
argument 'seed'...", check that scalar_types matches the groups
present in the file. Inspect with rhdf5::h5ls(filepath).
Slots
sourcesA named list of character vectors. Each element corresponds to a scalar and contains the source filenames (one per input file/subject).
scalarsA named list of DelayedArray matrices. Each matrix has elements as rows and source files as columns.
resultsA named list of analysis results. Each element is itself a list containing at minimum
results_matrix(a DelayedArray).pathCharacter. Path(s) to the HDF5 file(s) on disk.
See also
ModelArray for the constructor,
ModelArray.lm, ModelArray.gam,
ModelArray.wrap for analysis,
scalars, sources, results for
accessors.
ModelArray for the class definition,
h5summary for inspecting an HDF5 file without loading,
scalars, sources for accessing loaded data.