vec_from_vols: Create NeuroVec from list of NeuroVol objects

View source: R/neurovec.R

vec_from_volsR Documentation

Create NeuroVec from list of NeuroVol objects

Description

Factory function to create a NeuroVec object from a list of NeuroVol objects. This is a convenience wrapper around the NeuroVec constructor that combines multiple 3D volumes into a single 4D NeuroVec.

Usage

vec_from_vols(vols, mask = NULL)

Arguments

vols

A list of NeuroVol objects. All volumes must have identical spatial dimensions.

mask

An optional logical array or LogicalNeuroVol object defining the subset of voxels to include. If provided, a SparseNeuroVec will be created.

Value

A NeuroVec object (either DenseNeuroVec or SparseNeuroVec depending on whether a mask is provided).

See Also

NeuroVec, NeuroVol

Examples

# Create a simple NeuroVec from list of volumes
spc <- NeuroSpace(c(10, 10, 10))
vol1 <- NeuroVol(rnorm(10*10*10), spc)
vol2 <- NeuroVol(rnorm(10*10*10), spc)
vec <- vec_from_vols(list(vol1, vol2))
print(dim(vec))  # Should be c(10, 10, 10, 2)


neuroim2 documentation built on April 16, 2026, 5:07 p.m.