Status of Analyze 7.5 file format support

Hi all,

Now that the itkAnalyzeImageIO class is gone in ITK git master, I’m looking at updating my app (which uses this class).

First question: why was this class deprecated and removed anyway?

Anyway, I’ve been looking at using itkNiftiImageIO instead, and have read through the class. I have some trivial fixes here:

http://review.source.kitware.com/23082
http://review.source.kitware.com/23083
http://review.source.kitware.com/23084
http://review.source.kitware.com/23085

These are ready to merge IMHO.

But bigger problems I’d like to discuss, because I’m not sure of the solutions…:

  1. What are the desired semantics of SetImageIOMetadataFromNIfTI() exactly? It currently populates the metadata dictionary with data from the ‘nifti_1_header’, which is literally the first 348 bytes of the file. I’m thinking it might be better to populate it from ‘nifti_image’ instead, which is largely the same, but after some processing by nifti_convert_nhdr2nim(). For example, line 3765 forces the ‘qform_code’ field to 0 for Analyze 7.5 files, since that offset in the header had a different meaning pre-NIfTI. By using the literal header fields, SetImageIOMetadataFromNIfTI() is currently providing garbage sform and qform values for Analyze files. My WIP proposed fix is here:

http://review.source.kitware.com/23086

Which basically uses the data from ‘nifti_image’ instead. A handful of fields need a little manipulation to get back in the same format. I basically did what nifti_convert_nim2nhdr() does.

As a bonus, this removes extra file i/o by eliminating the nifti_read_header() call.

  1. There doesn’t seem to be a good way to query if the file read was Analyze 7.5 or NIfTI. I’d like to distinguish because my app gives a warning when Analyze is opened (to ween users off this format). My above patch adds the ‘nifti_type’ field to the metadata to make that info available.

  2. the ‘USE_VERY_VERBOSE_NIFTI_DEBUGGING’ option (that’s not compiled by default) is broken. When enabled, several tests fail with invalid memory access. I didn’t investigate much here…

Thanks,

Sean

Thanks for the patches, Sean. @hjmjohnson is the expert on this issue.