SparseNeuroVec-class: SparseNeuroVec

SparseNeuroVec-classR Documentation

SparseNeuroVec

Description

A class representing a sparse four-dimensional brain image, backed by a matrix, where each column represents a non-zero vector spanning the fourth dimension (e.g., time) and defined by a volumetric mask. SparseNeuroVec objects store their data in a compressed format, providing efficient storage and access to sparse brain images. This class inherits from the NeuroVec, AbstractSparseNeuroVec, and implements the ArrayLike4D interface.

Constructs a SparseNeuroVec object for efficient representation and manipulation of sparse neuroimaging data with many zero or missing values.

Usage

SparseNeuroVec(data, space, mask)

Arguments

data

A matrix or a 4-D array containing the neuroimaging data. The dimensions of the data should be consistent with the dimensions of the provided NeuroSpace object and mask.

space

A NeuroSpace object representing the dimensions and voxel spacing of the neuroimaging data.

mask

A 3D array, 1D vector of type logical, or an instance of type LogicalNeuroVol, which specifies the locations of the non-zero values in the data.

Value

A SparseNeuroVec object, containing the sparse neuroimaging data, mask, and associated NeuroSpace information.

Slots

data

A matrix of series, where rows span across voxel space and columns span the fourth dimension. Each column represents a non-zero vector in the 4D space, and the matrix stores only non-zero values to save memory.

Examples

bspace <- NeuroSpace(c(10,10,10,100), c(1,1,1))
mask <- array(rnorm(10*10*10) > .5, c(10,10,10))
mat <- matrix(rnorm(sum(mask)), 100, sum(mask))
svec <- SparseNeuroVec(mat, bspace, mask)
length(indices(svec)) == sum(mask)

bbuchsbaum/neuroim2 documentation built on April 20, 2024, 4:20 p.m.