This function is able to mask a 4-Dimensional image and create a matrix from it. Each column represents the same voxel in the xyz array while the rows represent the t-dimension.
ts2matrix(image, mask)
Arguments
image: Input image of type 'nifti'
mask: Input mask of type 'nifti'. Must be a binary mask
Examples
image <- oro.nifti::nifti(img = array(1:64, dim =c(4,4,4,5)))mask <- oro.nifti::nifti(img = array(0:1, dim = c(4,4,4)))matrix <- ts2matrix(image, mask)