Read images into rows of a matrix.

imageListToMatrix(
  imageList,
  mask,
  sigma = NA,
  epsilon = 0,
  asymmetryTx = NULL,
  asymmetryMask = NULL
)

Arguments

imageList

A character vector containing a list of image files to read, in order - these are image objects, not file names. these are assumed to be in a normalized space i.e. they are all in registration.

mask

An antsImage containing a binary mask, voxels in the mask are placed in the matrix. If not provided, estimated from first image in list. If the mask is a different size than the image, the images will be downsampled and smoothed to the size of the mask.

sigma

smoothing operation in physical space. See smoothImage.

epsilon

threshold value determining what is included in the mask

asymmetryTx

a reflection transform

asymmetryMask

a mask defining left and right side of the image. this should be defined in the space of the images within the imageList.

Value

A matrix containing the masked data, the result of calling as.numeric(image, mask) on each input image.

Author

Cook PA, Avants B, Kandel BM

Examples

img <- ri(1) %>% resampleImage(c(32, 32))
imglist <- list()
nsubj <- 3
for (ii in 1:nsubj) {
  imglist[[ii]] <- img
}
mask <- getMask(img)
imgmat <- imageListToMatrix(imglist, mask)
#> 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |=======================                                               |  33%
  |                                                                            
  |===============================================                       |  67%
  |                                                                            
  |======================================================================| 100%