set.seed(5)
dims = rep(10, 3)
arr = array(rpois(prod(dims), lambda = 2), dim = dims)
nim = oro.nifti::nifti(arr)
simg = separate_img(nim)
simg_arr = separate_img(arr)
slist = lapply(simg, function(x) array(x, dim(x)))
testthat::expect_equal(slist, simg_arr)
rnifti = RNifti::asNifti(nim)
timg = tempimg(nim)
limg = list(factor(timg), factor(timg))
func = separate_img
func(arr)
func(nim)
func(rnifti)
func(timg)
func(limg)
Run the code above in your browser using DataLab