do.mask: Masking/unmasking your niftiXd object

do.maskR Documentation

Masking/unmasking your niftiXd object

Description

Mask/unmask the voxels of your niftiXd object

Usage

do.mask(x, mask, thresh=0, output.prefix=NULL)
do.unmask(x, return.niftiXd=TRUE)

Arguments

x

niftiXd object

mask

A vector

thresh

If the mask isn't logical, what values should we threshold it at (default: 0)

output.prefix

if you have big.niftiXd object that is file-backed, you can specify this option

return.niftiXd

Whether or not to return a niftiXd type object (doesn't apply to big.niftiXd objects) for unmask function only

Details

Masking a niftiXd object involves including only those columns (voxels) that are specified as TRUE or above a given threshold in the input mask.

The benefit of using this function over just x[,mask] is that it will keep a record of the regions that were masked, allowing you to go back to the original structure with do.unmask or easily save your file in the appropriate dimensions with write.nifti.

The mask input argument can have a length that is: (1) equal to the total number of voxels in the original nifti image (2) equal to the number of columns or elements in your input x

Note that columns or elements in a niftiXd correspond to different voxels in 3D space.

The do.unmask function puts back the columns or vector elements that were previously masked. The values of these new elements will be set to 0.

Value

A masked niftiXd object for mask and unmask;

Author(s)

Zarrar Shehzad


czarrar/niftir documentation built on April 19, 2022, 3:35 a.m.