Read Headers and Binary Image Files for Medical Imaging Data

Share:

Description

These functions read in the header information and/or multidimensional array from a binary file in ANALYZE or NIfTI formats.

Usage

1
2
3
read.hdr(fname, verbose=FALSE, warn=-1)
read.img(fname, verbose=FALSE, warn=-1, ...)
make.hdr(X, Y, Z, T, datatype, type)

Arguments

fname

is the pathname of the Analyze pair of files (.img and .hdr) or the single NIfTI file (.nii).

verbose

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

X,Y,Z,T

are the dimenisions (three spatial and one temporal) for the header file.

datatype

is a character string describing the image format. Valid character strings include: “uint1”, “uint8”, “int16”, “int32”, “float32”, “float64”.

type

is a character string declaring either the Analyze or NIfTI format (default = analyze).

warn

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

...

is for additional parameters that may be passed to read.nifti.img.

Details

The function read.hdr decides whether the input file should be read using read.analyze.hdr or read.nifti.hdr and if compression is required. A similar description is valid for the read.img function. They are essentially “wrapper” functions for calls to the functions that are specific to the Analyze or NIfTI formats.

The make.hdr function provides an empty header, in Analyze or NIfTI format, to use for data exportation. Note, it is probably better to read in a pre-existing header file and modify it as required.

Value

The read.hdr function returns a list containing all the fields from the header file. The read.img function returns a multidimensional array taken from the binary imaging data.

Author(s)

Brandon Whitcher, Volker Schmid

References

ANALYZE 7.5 http://www.mayo.edu/bir/PDF/ANALYZE75.pdf

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

See Also

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