ni2header.template: Create a template NIFTI v2 header. You will have to adapt it...

View source: R/write_nifti2.R

ni2header.templateR Documentation

Create a template NIFTI v2 header. You will have to adapt it for your use case.

Description

Create a template NIFTI v2 header. You will have to adapt it for your use case.

Usage

ni2header.template()

Value

named list, the NIFTI v2 header. All fields are present and filled with values of a proper type. Whether or not they make sense is up to you, but you will most likely have to adapt at least the following fields to your data: dim_raw, datatype, bitpix.

Note

Commonly used data type settings are: for signed integers datatype = 8L and bitpix = 32L; for floats datatype = 16L and bitpix = 32L. See the NIFTI v2 standard for more options. You may want to call ni2header.for.data instead of this function.

The 'magic' field of a NIFTI v2 file must be the string 'n+2'. Versions of this package before 1.1.0 wrote the NIFTI v1 magic 'n+1' here, which violates the standard and makes other software (nibabel, Connectome Workbench) refuse the file; write.nifti2 writes the full 8 byte magic of the standard.

See Also

ni2header.for.data


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