Skip to contents

This S4 class represents a three-dimensional brain image, which is stored using a sparse data representation, backed by a sparseVector from the Matrix package. Sparse representations are beneficial for storing and processing large brain images with a high proportion of zero or missing values.

Construct a SparseNeuroVol instance

Usage

SparseNeuroVol(data, space, indices = NULL, label = "")

Arguments

data

a numeric vector

space

an instance of class NeuroSpace

indices

a index vector indicating the 1-d coordinates of the data values

label

a character string

Value

SparseNeuroVol instance

Details

Image data is backed by Matrix::sparseVector.

Slots

data

A sparseVector instance from the Matrix package, which stores the image volume data in a sparse format.

See also

Examples

data <- 1:10
indices <- seq(1,1000, length.out=10)
bspace <- NeuroSpace(c(64,64,64), spacing=c(1,1,1))
sparsevol <- SparseNeuroVol(data,bspace,indices=indices)
densevol <- NeuroVol(data,bspace,indices=indices)
sum(sparsevol) == sum(densevol)
#> [1] TRUE