Learn R Programming

neurobase (version 1.32.4)

writeNIfTI2: writeNIfTI with default non-reorientation

Description

This function calls the writeNIfTI function from the oro.nifti package, but makes sure to remove .nii extension and warnings can be suppressed.

Usage

writeNIfTI2(nim, filename, dtype = FALSE, compression = 9, ...)

writenii( nim, filename, dtype = TRUE, drop_dim = TRUE, warn = FALSE, compression = 9, rm_extensions = TRUE, ... )

Value

Nothing

Arguments

nim

object of class nifti, passed to writeNIfTI

filename

path to save the NIfTI file. Suffix will be removed

dtype

Should datatyper be run before writing?

compression

compression level for gzipped files.

...

Additional arguments passed to writeNIfTI

drop_dim

Should drop_img_dim be run before writing?

warn

Should warnings from writeNIfTI be printed? If not, suppressWarnings is called

rm_extensions

should niftiExtensions be converted to simple nifti objects before writing?

Examples

Run this code
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)
timg = writeNIfTI2(nim, tfile, dtype = TRUE)

Run the code above in your browser using DataLab