readNifti: Read a NIfTI-1 format file

Description Usage Arguments Value Note Author(s) References See Also Examples

View source: R/nifti.R

Description

This function reads one or more NIfTI-1 files into R, using the standard NIfTI-1 C library.

Usage

1
readNifti(file, internal = FALSE)

Arguments

file

A character vector of file names.

internal

Logical value. If FALSE (the default), an array of class "niftiImage", containing the image pixel or voxel values, will be returned. If TRUE, the return value will be an object of class "internalImage", which contains only minimal metadata about the image. Either way, the return value has an attribute which points to a C data structure containing the full image.

Value

An array or internal image, with class "niftiImage", and possibly also "internalImage".

Note

If the internal argument is FALSE (the default), the data type of the image pointer will be set to match one of R's native numeric data types, i.e., 32-bit signed integer or 64-bit double-precision floating-point. In these circumstances the data type reported by the dumpNifti function will therefore not, in general, match the storage type used in the file. See also the datatype argument to writeNifti.

Author(s)

Jon Clayden <code@clayden.org>

References

The NIfTI-1 standard (http://www.nitrc.org/docman/view.php/26/64/nifti1.h).

See Also

writeNifti

Examples

1
2
3
path <- system.file("extdata", "example.nii.gz", package="RNifti")
readNifti(path)
readNifti(path, internal=TRUE)

RNifti documentation built on June 20, 2017, 9:09 a.m.

Search within the RNifti package
Search all R packages, documentation and source code