Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

niftiHeader

Dump or construct a raw NIfTI or ANALYZE header


Description

These functions extract the contents of a NIfTI-1 or ANALYZE-7.5 header, closely approximating how it is (or would be) stored on disk. Defaults will be used where information is missing, but no processing is performed on the metadata.

Usage

niftiHeader(image = list())

analyzeHeader(image = list())

## S3 method for class 'niftiHeader'
print(x, ...)

## S3 method for class 'analyzeHeader'
print(x, ...)

Arguments

image

An image, in any acceptable form (see asNifti). A list containing partial header information is acceptable, including an empty list, which returns defaults for every field.

x

A "niftiHeader" object.

...

Ignored.

Details

The NIfTI-1 standard was originally formulated as a roughly backwards- compatible improvement on the ANALYZE format. Both formats use a binary header structure of 348 bytes, but the field names and their interpretation is often non-equivalent. These functions dump these fields, without regard to whether or not the result makes proper sense.

dumpNifti is an alias of niftiHeader, but the former is now soft-deprecated.

Value

For niftiHeader, a list of class "niftiHeader", with named components corresponding to the elements in a raw NIfTI-1 header. For analyzeHeader, the equivalent for ANALYZE-7.5.

Note

Several medical image analysis packages, such as SPM and FSL, use the ANALYZE originator field to store a coordinate origin. This interpretation is also returned, in the origin field.

Both of these functions call asNifti on their arguments to coerce it to NIfTI, except in one specific circumstance: when analyzeHeader is called with a single-element character-mode argument that is not an "internalImage" object. In this case the string is taken to be a path and the header is reported as stored on disk. This is because otherwise the header may be changed by the process of converting it to NIfTI and back.

Author(s)

Jon Clayden <code@clayden.org>

References

See Also

Examples

niftiHeader(system.file("extdata", "example.nii.gz", package="RNifti"))

# Default header for a standard R array
niftiHeader(array(0L, dim=c(10,10)))

RNifti

Fast R and C++ Access to NIfTI Images

v1.3.0
GPL-2
Authors
Jon Clayden [cre, aut] (<https://orcid.org/0000-0002-6608-0619>), Bob Cox [aut], Mark Jenkinson [aut], Matt Hall [ctb], Rick Reynolds [ctb], Kate Fissell [ctb], Jean-loup Gailly [cph], Mark Adler [cph]
Initial release
2020-12-04

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.