# Status of Analyze 7.5 file format support

**URL:** https://discourse.itk.org/t/status-of-analyze-7-5-file-format-support/624
**Category:** Engineering
**Created:** [January 26, 2018, 6:29pm UTC](https://discourse.itk.org/t/status-of-analyze-7-5-file-format-support/624 "2018-01-26T18:29:14Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![seanm](https://discourse.itk.org/letter_avatar_proxy/v4/letter/s/a88e4f/32.png) [@seanm](https://discourse.itk.org/u/seanm)
#### Post date: [January 26, 2018, 6:29pm UTC](https://discourse.itk.org/t/status-of-analyze-7-5-file-format-support/624/1 "2018-01-26T18:29:14Z")

</div>

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/23082)  
[http://review.source.kitware.com/23083](http://review.source.kitware.com/23083)  
[http://review.source.kitware.com/23084](http://review.source.kitware.com/23084)  
[http://review.source.kitware.com/23085](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](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

---

<div class="post-metadata">

### Author: ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)
#### Post date: [January 26, 2018, 8:11pm UTC](https://discourse.itk.org/t/status-of-analyze-7-5-file-format-support/624/2 "2018-01-26T20:11:25Z")

</div>

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