Learn R Programming

neuroim2 (version 0.8.5)

FileBackedNeuroVec-class: 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.

Arguments

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.

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.

See Also

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

FileBackedNeuroVec for creating instances of this class

Examples

Run this code
# Load example 4D image file included with package
file_path <- system.file("extdata", "global_mask_v4.nii", package = "neuroim2")
fbvec <- FileBackedNeuroVec(file_path)

# Get dimensions of the image
dim(fbvec)

# Extract first volume
vol1 <- sub_vector(fbvec, 1)

# Extract multiple volumes
vols <- sub_vector(fbvec, 1:2)

Run the code above in your browser using DataLab