fast_readnii: Reading NIfTI images through RNifti

Description Usage Arguments Value Examples

View source: R/fast_readnii.R

Description

This function calls the readNifti function from the RNifti package, and then converts the image to a nifti object

Usage

1
fast_readnii(fname, dtype = TRUE, drop_dim = TRUE)

Arguments

fname

file name of the NIfTI file.

dtype

Should datatyper be run after reading?

drop_dim

Should drop_img_dim be run after reading?

Value

A nifti object

Examples

1
2
3
4
5
6
7
set.seed(5)
dims = rep(10, 4)
arr = array(rpois(prod(dims), lambda = 2), dim = dims)
nim = oro.nifti::nifti(arr)
tfile = tempfile(fileext = ".nii.gz")
write_nifti(nim, tfile)
rimg = fast_readnii(tfile)

neuroconductor/neurobase documentation built on May 19, 2021, 5:24 a.m.