With the NIfTI-1 header extensions the world is your oyster. We decided that one use for such a capability is to keep an audit trail of all operations performed on the image data volume. This is a key feature in the
dcemriS4 package. There are three main components to a NIfTI-1 header extension: esize, ecode and edata. At first we arbitrarily set ecode = 1002 and further developed the software. Turns out,
FSLView is quite strict about the numbers used in ecode and it failed to accept our NIfTI-1 header extensions saved from R. Looking at the file nifti1_io.h, the following ecodes have been defined:
Advice from the FSL team (thanks: Matt Webster and Dave Flitney) was for us to use ecode = 6 (ASCII) since the audit trail is text in XML format. Now one can produce an example data volume
We now have a file "img_nifti.nii.gz" that is available to us and using a utility in FSL we can investigate the attributes of this file
% $FSLDIR/bin/fslhd img_nifti | grep 'vox_offset'
vox_offset 1168
and reading the file back into R allows us to interrogate the ecode via its S4 slot