set.seed(5)
dims = rep(10, 3)
arr = array(rnorm(prod(dims)), dim = dims)
arr[,,10] = 0
nim = oro.nifti::nifti(arr)
dnim = dropEmptyImageDimensions(nim, keep_ind = TRUE)
new_nim = dnim$outimg
names(dnim)
dnim = dropEmptyImageDimensions(nim, keep_ind = TRUE, other.imgs = nim)
dims = rep(10, 4)
arr = array(rnorm(prod(dims)), dim = dims)
nim = oro.nifti::nifti(arr)
testthat::expect_error(
{dnim = dropEmptyImageDimensions(nim, keep_ind = TRUE)}
)
Run the code above in your browser using DataLab