header-methods: Access NIfTI Header Information

headerR Documentation

Description

Retrieves header metadata from neuroimaging objects or files. Returns a structured list with commonly needed fields like sform/qform matrices, TR, intent codes, and data scaling parameters.

For low-level access to all raw NIfTI header fields, use the $raw element of the returned list.

Usage

header(x)

## S4 method for signature 'FileMetaInfo'
header(x)

## S4 method for signature 'character'
header(x)

Arguments

x

A NeuroVol, NeuroVec, FileMetaInfo, or a character file path.

Value

A list of class "NeuroHeader" with elements:

dim

Integer dimensions.

pixdim

Voxel sizes including TR.

spacing

Spatial voxel sizes (first 3 pixdim values).

origin

Coordinate origin.

trans

4x4 affine transform.

qform

List with matrix (4x4) and code (integer).

sform

List with matrix (4x4) and code (integer).

intent_code

NIfTI intent code.

intent_name

NIfTI intent name string.

descrip

Description string.

data_type

Storage data type label.

bitpix

Bits per pixel.

scl_slope

Data scaling slope.

scl_inter

Data scaling intercept.

cal_min

Display intensity minimum.

cal_max

Display intensity maximum.

TR

Repetition time (4th pixdim), or NA if not 4D.

raw

The complete raw header list (all NIfTI fields).

Examples


f <- system.file("extdata", "global_mask_v4.nii", package = "neuroim2")
h <- header(f)
h$dim
h$TR
h$sform
h$descrip



neuroim2 documentation built on April 16, 2026, 5:07 p.m.