FileBackedNeuroVec-class: FileBackedNeuroVec Class

FileBackedNeuroVec-classR Documentation

FileBackedNeuroVec Class

Description

A class representing a four-dimensional brain image that uses on-demand loading through memory-mapped file access. This approach enables efficient handling of large-scale brain imaging data by loading only the required portions of the data into memory when needed.

The FileBackedNeuroVec class represents a memory-efficient vector of neuroimaging data that is stored on disk rather than in memory. This is particularly useful for large datasets where memory constraints are a concern.

Details

FileBackedNeuroVec objects provide a memory-efficient solution for working with large 4D neuroimaging datasets. By utilizing memory-mapped file access, this class allows users to work with datasets that exceed available RAM, only loading the necessary data segments into memory as they are accessed.

Slots

meta

An instance of class FileMetaInfo containing file metadata such as file path, format, and other associated information.

Inheritance

FileBackedNeuroVec inherits from:

  • NeuroVec: Base class for 4D brain images

  • ArrayLike4D: Interface for 4D array-like operations

Memory Management

Data is read from disk on-demand, reducing memory usage compared to in-memory storage. The trade-off is slightly slower access times due to disk I/O operations.

See Also

NeuroVec-class for the base 4D brain image class. FileMetaInfo-class for details on file metadata representation.

Examples

## Not run: 
# Create a FileBackedNeuroVec object
file_path <- "/path/to/large/brain/image.nii.gz"
file_meta <- FileMetaInfo(file_path, format = "NIFTI")
file_backed_vec <- FileBackedNeuroVec(meta = file_meta)

# Access a subset of the data (this will load only the required portion)
subset <- file_backed_vec[,,, 1:10]

## End(Not run)


bbuchsbaum/neuroim2 documentation built on Jan. 2, 2025, 3:38 p.m.