writeNIfTI2: writeNIfTI with default non-reorientation

Description Usage Arguments Value Note Examples

View source: R/writenii.R

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
writeNIfTI2(nim, filename, dtype = FALSE, compression = 9, ...)

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

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?

Value

Nothing

Note

While writeNIfTI2 does not run datatyper as default, writenii does. Additional functionality will be added to writenii likely but will not to writeNIfTI2

Examples

1
2
3
4
5
6
7
8
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)

neuroconductor-devel/neurobase documentation built on May 6, 2021, 1:48 p.m.