SparseNeuroVol-class | R Documentation |
This class represents a three-dimensional brain image using a sparse data representation. It is particularly useful for large brain images with a high proportion of zero or missing values, offering efficient storage and processing.
Construct a SparseNeuroVol
instance
SparseNeuroVol(data, space, indices = NULL, label = "")
data |
a numeric vector or ROIVol |
space |
an instance of class |
indices |
a index vector indicating the 1-d coordinates of the data values |
label |
a |
The SparseNeuroVol class extends the NeuroVol
class and
implements the ArrayLike3D interface. It uses a sparseVector
from the Matrix package to store the image data, which allows for memory-efficient
representation of sparse 3D neuroimaging data.
Image data is backed by Matrix::sparseVector
.
SparseNeuroVol
instance
data
A sparseVector
object from the Matrix package,
storing the image volume data in a sparse format.
Bates, D., & Maechler, M. (2019). Matrix: Sparse and Dense Matrix Classes and Methods. R package version 1.2-18. https://CRAN.R-project.org/package=Matrix
NeuroVol-class
for the base volumetric image class.
DenseNeuroVol-class
for a dense representation of 3D brain images.
sparseVector-class
for details on the underlying sparse data structure.
## Not run:
# Create a sparse 3D brain image
dim <- c(64L, 64L, 64L)
space <- NeuroSpace(dim = dim, origin = c(0, 0, 0), spacing = c(1, 1, 1))
sparse_data <- Matrix::sparseVector(x = c(1, 2, 3),
i = c(100, 1000, 10000),
length = prod(dim))
sparse_vol <- new("SparseNeuroVol", space = space, data = sparse_data)
## End(Not run)
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.