Turns a 4D time series image to a list of 3D images
img_ts_to_list(imgs, copy_nifti = TRUE, warn = TRUE)
imgs | object of class |
---|---|
copy_nifti | Should |
warn | Should a warning be printed if object is not class
|
List of images
If the object is not of class nifti
or have
4 dimensions, then the object is returned
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)
#> Warning: Object is not of class nifti
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)