Read NIfTI Format Headers and Image Files

Share:

Description

These functions read in the header information and multidimensional array from a binary file in NIfTI-1 format.

Usage

1
2
3
4
read.nifti.hdr(fname, onefile=TRUE, gzipped=TRUE, verbose=FALSE,
               warn=-1)
read.nifti.img(fname, onefile=TRUE, gzipped=TRUE, verbose=FALSE,
               warn=-1, ignoreQform=FALSE, ignoreSform=FALSE)

Arguments

fname

Pathname of the NIfTI file(s).

onefile

Allows the scanning of single-file format (.nii) or dual-file format (.hdr and .img) NIfTI files.

gzipped

Allows the importation of compressed (.gz) files.

verbose

is a logical variable (default = FALSE) that allows text-based feedback during execution of the function.

warn

is a number to regulate the display of warnings (default = -1). See options for more details.

ignoreQform

is a logical variable (default = FALSE) that ignores any ‘qform’ infomration in the NIfTI header.

ignoreSform

is a logical variable (default = FALSE) that ignores any ‘sform’ infomration in the NIfTI header.

Details

Both functions utilize the internal readBin and readChar command to efficiently extract information from the binary file(s). The types of data are limited to 1- and 2-byte integers, 4-byte floats and 8-byte doubles.

Value

read.nifti.hdr returns a list containing all the fields from the header file. read.nifti.img returns a multidimensional array depending on the fields obtained from the header file.

Author(s)

Brandon Whitcher

References

NIfTI-1 http://nifti.nimh.nih.gov/

See Also

read.analyze.hdr, read.analyze.img, write.nifti.img