nifti2.extension: Create a NIFTI v2 header extension.

View source: R/nifti2_extensions.R

nifti2.extensionR Documentation

Create a NIFTI v2 header extension.

Description

NIFTI v2 files can store arbitrary data in header extensions, in the area between the header and the voxel data. This function creates such an extension. Pass the result to write.nifti2, which writes it to the file, and later read it back with read.nifti2.header plus nifti2.get.extension.

Usage

nifti2.extension(ecode, content = NULL)

Arguments

ecode

integer, the extension code. This identifies the type of the payload, but the code is not interpreted in any way. The CIFTI2 XML metadata uses code 32L.

content

raw vector, character string, or NULL. The payload of the extension, i.e., the data to store. A character string is converted to UTF-8 bytes (several strings are joined with newline characters). Use NULL or omit for an empty payload.

Value

named list with the entries 'ecode' and 'content', representing one NIFTI v2 header extension.

See Also

nifti2.get.extension, nifti2.extension.text

Other nifti2 extensions: nifti2.extension.content(), nifti2.extension.size(), nifti2.extension.text(), nifti2.get.extension()


freesurferformats documentation built on Sept. 25, 2026, 1:07 a.m.