| mask | R Documentation |
Generic function to extract or generate a mask from neuroimaging objects.
For sparse objects with a @mask slot, returns the stored mask.
For dense objects, returns a filled mask (all TRUE values) indicating
all voxels contain valid data.
mask(x)
## S4 method for signature 'ClusteredNeuroVol'
mask(x)
## S4 method for signature 'FileBackedNeuroVec'
mask(x)
## S4 method for signature 'MappedNeuroVec'
mask(x)
## S4 method for signature 'NeuroHyperVec'
mask(x)
## S4 method for signature 'NeuroSlice'
mask(x)
## S4 method for signature 'DenseNeuroVec'
mask(x)
## S4 method for signature 'DenseNeuroVol'
mask(x)
## S4 method for signature 'LogicalNeuroVol'
mask(x)
## S4 method for signature 'AbstractSparseNeuroVec'
mask(x)
## S4 method for signature 'SparseNeuroVecSource'
mask(x)
x |
A neuroimaging object (NeuroVol, NeuroVec, or derived classes) |
The behavior depends on the class of the input object:
For sparse objects (SparseNeuroVec, ClusteredNeuroVol, etc.):
Returns the stored @mask slot
For dense objects (DenseNeuroVol, DenseNeuroVec, etc.): Returns a LogicalNeuroVol with all TRUE values
For ROI objects: Not implemented (use coords() instead)
A LogicalNeuroVol object representing the mask
# Create a dense volume
vol <- NeuroVol(array(rnorm(64^3), c(64,64,64)), NeuroSpace(c(64,64,64)))
m <- mask(vol) # Returns all TRUE mask
# Create a sparse vector with explicit mask
mask_array <- array(runif(64^3) > 0.5, c(64,64,64))
mask_vol <- LogicalNeuroVol(mask_array, NeuroSpace(c(64,64,64)))
# Data must be a matrix (time x masked voxels)
sparse_data <- matrix(rnorm(sum(mask_array) * 10), nrow = 10, ncol = sum(mask_array))
svec <- SparseNeuroVec(sparse_data, NeuroSpace(c(64,64,64,10)), mask_vol)
m2 <- mask(svec) # Returns the stored mask
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.