It's right at the end of the .hdr:
char magic[4] ; /*!< MUST be "ni1\0" or "n+1\0". */
/* DATA STORAGE:
------------
If the magic field is "n+1", then the voxel data is stored in the
same file as the header. In this case, the voxel data starts at offset
(int)vox_offset into the header file. Thus, vox_offset=352.0 means that
the data starts immediately after the NIFTI-1 header. If vox_offset is
greater than 352, the NIFTI-1 format does not say much about the
contents of the dataset file between the end of the header and the
start of the data.
FILES:
-----
If the magic field is "ni1", then the voxel data is stored in the
associated ".img" file, starting at offset 0 (i.e., vox_offset is not
used in this case, and should be set to 0.0).
When storing NIFTI-1 datasets in pairs of files, it is customary to name
the files in the pattern "name.hdr" and "name.img", as in ANALYZE 7.5.
When storing in a single file ("n+1"), the file name should be in
the form "name.nii" (the ".nft" and ".nif" suffixes are already taken;
cf. http://www.icdatamaster.com/n.html ).
Best regards,
-John
On Monday 01 September 2008 16:34, Neggers, S.F.W. wrote:
> Dear coders among you SPMers,
>
> I am writing a tool that I want to autimatically recognize whether it
> deals with analyze 7.5 or nifti data, when it is given a filename.
> Sometimes that is easily determined from the file extention, when it is
> given a *.nii file. When however an *.img or *.hdr file is provided, it
> can be both analyze or nifti, because the latter format comes in both
> flavours.
>
> I was hoping that this information would have been stored in the header
> file.
>
> In the documentation of the nifti specs at
> http://nifti.nimh.nih.gov/nifti-1/documentation/nifti1fields
> I did not find a field that, to my knowlegde, uniqely specifies a file
> as nifti or analyze.
> Perhaps the NIFTIINTENT code is useful, but it is unused in Analyze so
> it could theoretically be anything there and mess up automatic
> recognition.
>
> Perhaps some of you encountered the same issue and can give me some
> hints to a method that works. I would rather not have the user have to
> specify the file format.
>
> Regards,
>
> Bas
>
>
>
> --------------------------------------------------
> Dr. S.F.W. Neggers
> Division of Brain Research
> Rudolf Magnus Institute for Neuroscience
> Utrecht University Medical Center
>
> Visiting : Heidelberglaan 100, 3584 CX Utrecht
> Room B.01.1.03
> Mail : Huispost B.01.206, P.O. Box 85500
> 3508 GA Utrecht, the Netherlands
> Tel : +31 (0)88 7559609
> Fax : +31 (0)88 7555443
> E-mail : [log in to unmask]
> Web : http://www.fmri.nl/people/bas.html
> --------------------------------------------------
|