Skip to contents

Constructs a LatentNeuroVec-class object, which provides a memory-efficient representation of neuroimaging data using matrix factorization. This is particularly useful for dimensionality reduction techniques (e.g., PCA or ICA).

Usage

LatentNeuroVec(basis, loadings, space, mask, offset = NULL, label = "")

Arguments

basis

A numeric or Matrix object (\(n \times k\)) containing the temporal basis.

loadings

A numeric or Matrix object (\(p \times k\)) containing spatial loadings.

space

A NeuroSpace-class defining the spatial/temporal dims.

mask

A LogicalNeuroVol-class defining the brain mask.

offset

Optional numeric vector of length \(p\) (voxel-wise offsets).

label

Optional character label for the object.

Value

A new LatentNeuroVec-class instance.

Details

Construct a LatentNeuroVec Object

Examples

if (FALSE) { # \dontrun{
library(Matrix)
library(neuroim2)

# Example data
n_timepoints <- 100
n_components <- 10
n_voxels <- 1000

# Create basis & loadings
basis <- Matrix(rnorm(n_timepoints * n_components),
  nrow = n_timepoints,
  ncol = n_components)
loadings <- Matrix(rnorm(n_voxels * n_components),
  nrow = n_voxels,
  ncol = n_components,
  sparse = TRUE)

# Create space (10x10x10 volume, 100 timepoints)
spc <- NeuroSpace(c(10, 10, 10, n_timepoints))

# Create mask
mask_array <- array(TRUE, dim = c(10, 10, 10))
mask_vol   <- LogicalNeuroVol(mask_array, NeuroSpace(c(10, 10, 10)))

# Construct LatentNeuroVec
lvec <- LatentNeuroVec(basis = basis,
  loadings = loadings,
  space = spc,
  mask = mask_vol)
} # }