Given a NeuroVol object (or similar), this function
builds a basic NIfTI-1 header structure, populating essential fields such as
dim, pixdim, datatype, the affine transform, and the
quaternion parameters.
Arguments
- vol
A
NeuroVol(or 3D array-like) specifying dimensions, spacing, and affine transform.- file_name
A character string for the file name (used within the header but not necessarily to write data).
- oneFile
Logical; if
TRUE, sets the NIfTI magic to"n+1", implying a single-file format (.nii). IfFALSE, uses"ni1"(header+image).- data_type
Character specifying the data representation, e.g.
"FLOAT","DOUBLE". The internal code picks an integer NIfTI code.
Value
A list representing the NIfTI-1 header fields, containing
elements like dimensions, pixdim, datatype, qform,
quaternion, qfac, etc. This can be passed to other
functions that write or manipulate the header.
Details
This is a convenience function that calls createNIfTIHeader
first, then updates the fields (dimensions, pixdim, orientation, etc.)
based on the vol argument. The voxel offset is set to 352 bytes, and
the quaternion is derived from the transform matrix via
matrixToQuatern.
Note: This function primarily sets up a minimal header suitable for writing standard single-file NIfTI-1. If you need a more comprehensive or advanced usage, consider manually editing the returned list.
See also
createNIfTIHeader for the base constructor of an empty NIfTI header.