timeseries2matrix: Time-series image to matrix

View source: R/timeseries2matrix.R

timeseries2matrixR Documentation

Time-series image to matrix

Description

Extract a matrix from a time-series image after applying a mask.

Usage

timeseries2matrix(img, mask)

Arguments

img

Input image of type 'antsImage' or R array.

mask

Input mask of type 'antsImage' or R array. In either case, the number of voxels in the mask may be either equal to that of input image 'img' or equal to number of voxels in one time unit of input image 'img'. In the second case, the mask is reused for every time unit of the 'img'. A mask of n-labels will cause the function to return a matrix containing the mean time series within each label.

Value

Success – an R matrix of dimensions ( dim(img)[length(dim(img))] , sum(mask==1) )

Author(s)

Shrinidhi KL

Examples


img <- makeImage(c(10, 10, 10, 5), 0)
# or use antsImageRead ...
mask <- array(1, dim(img)[1:3])
mat <- timeseries2matrix(img, mask)


stnava/ANTsR documentation built on April 16, 2024, 12:17 a.m.