fast_readnii: Reading NIfTI images through RNifti

View source: R/fast_readnii.R

fast_readniiR Documentation

Reading NIfTI images through RNifti

Description

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

Usage

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

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)

neurobase documentation built on Oct. 23, 2022, 5:05 p.m.