This page provides a summary of the available NIfTI-1 data conversion and extraction methods in nifti1.h and nifti1_io.h/c.
Method 1: translation only: use pixdim[1,2,3] parameters
Method 2: rigid body transformation: use pixdim[1,2,3], quaternion parameters and offset parameter
Method 3: affine transformation: use matrix in srow_x,y,z parameters
Available function in nifti1_io for methods 2 and 3: mat44_to_orientation( )
Use quatern_to_mat44( ) and mat44_to_quatern( ) in nifti1_io.
The nifti1 macro's DIM_INFO_TO_FREQ_DIM, DIM_INFO_TO_PHASE_DIM, and DIM_INFO_TO_SLICE_DIM can be used to extract the slice acquisition and timing parameter values from the dim_info byte. The macro FPS_INTO_DIM_INFO in nifti1 uses parameters in freq_dim, phase_dim and slice_dim.
The macros XYZT_TO_SPACE and XYZT_TO_TIME can be used to mask off the undesired bits from the xyzt_units fields, leaving "pure" space and time codes. Inversely, the macro SPACE_TIME_TO_XYZT can be used to assemble a space code (0,1,2,...,7) with a time code (0,8,16,32,...,56) into the combined value for xyzt_units.
Use macro NIFTI_NEEDS_SWAP( ) in nifti1.h and methods swap_nifti_header( ) and swap_2bytes( ), swap_4bytes( ), swap_8bytes( ), swap_16bytes( ) and swap_Nbytes( ) in nifti1_io.
In case extra data are provided with the file, this is indicated in the bytes 348 - 352 of the NIfTI-1 header.