This function calls the writeNIfTI
function from the
oro.nifti
package, but makes sure to remove .nii
extension and
warnings can be suppressed.
writeNIfTI2(nim, filename, dtype = FALSE, compression = 9, ...)
writenii(
nim,
filename,
dtype = TRUE,
drop_dim = TRUE,
warn = FALSE,
compression = 9,
rm_extensions = TRUE,
...
)
nim | object of class |
---|---|
filename | path to save the NIfTI file. Suffix will be removed |
dtype | Should |
compression | compression level for gzipped files. |
... | Additional arguments passed to |
drop_dim | Should |
warn | Should warnings from |
rm_extensions | should niftiExtensions be converted to simple nifti objects before writing? |
Nothing
While writeNIfTI2
does not run datatyper
as default,
writenii
does. Additional functionality will be added to writenii
likely
but will not to writeNIfTI2
set.seed(5)
dims = rep(10, 3)
arr = array(rnorm(prod(dims)), dim = dims)
nim = oro.nifti::nifti(arr)
rnifti = RNifti::asNifti(nim)
tfile = tempfile(fileext = ".nii.gz")
timg = writenii(nim, tfile, rm_extensions = TRUE, warn = TRUE)
#> Warning: Assuming FLOAT32
timg = writeNIfTI2(nim, tfile, dtype = TRUE)
#> Warning: Assuming FLOAT32