Ensures the output to be a character filename (or vector)
from an input
image or nifti
, to be gzipped and has .nii.gz
extension
checkniigz(file, ...)
# S4 method for nifti
checkniigz(file, ...)
# S4 method for ANY
checkniigz(file, ...)
# S4 method for factor
checkniigz(file, ...)
# S4 method for character
checkniigz(file, ...)
# S4 method for list
checkniigz(file, ...)
ensure_nii_gz(file, ...)
file | character or |
---|---|
... | options passed to |
Character filename of image or temporary nii, with .nii.gz extension
John Muschelli muschellij2@gmail.com
set.seed(5)
dims = rep(10, 3)
arr = array(rnorm(prod(dims)), dim = dims)
arr[,,10] = 0
nim = oro.nifti::nifti(arr)
rnifti = RNifti::asNifti(nim)
timg = tempimg(nim)
limg = list(factor(timg), factor(timg))
func = checkniigz
func(nim)
#> [1] "/tmp/RtmpBb1B9G/file16b7333cb104d.nii.gz"
func(rnifti)
#> [1] "/tmp/RtmpBb1B9G/file16b7327ca926d.nii.gz"
func(timg)
#> [1] "/tmp/RtmpBb1B9G/file16b732126f049.nii.gz"
func(limg)
#> [1] "/tmp/RtmpBb1B9G/file16b732126f049.nii.gz"
#> [2] "/tmp/RtmpBb1B9G/file16b732126f049.nii.gz"