img_ts_to_list: Image Time Series to list

Description Usage Arguments Value Note Examples

View source: R/img_ts_to_list.R

Description

Turns a 4D time series image to a list of 3D images

Usage

1
img_ts_to_list(imgs, copy_nifti = TRUE, warn = TRUE)

Arguments

imgs

object of class nifti with 4 dimensions, aka a 4D time series

copy_nifti

Should nifti objects be returned (TRUE) or simply arrays (FALSE). Should only be used for slight speed up when array is adequate

warn

Should a warning be printed if object is not class nifti

Value

List of images

Note

If the object is not of class nifti or have 4 dimensions, then the object is returned

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
set.seed(5)
dims = rep(10, 4)
arr = array(rpois(prod(dims), lambda = 2), dim = dims)
nim = oro.nifti::nifti(arr)
simg = img_ts_to_list(nim)
simg_arr = img_ts_to_list(arr)
back = img_list_to_ts(simg_arr)
slist = lapply(simg, function(x) array(x, dim(x)))
testthat::expect_equal(slist, simg_arr)
simg_arr = img_ts_to_matrix(arr)
simg_arr = img_ts_to_df(arr)

neuroconductor/neurobase documentation built on May 19, 2021, 5:24 a.m.