[Insight-developers] NIfTI char images with slope/intercept value rescale not being read in correctly -- my proposed fix

Luis Ibanez luis.ibanez at kitware.com
Thu Sep 13 12:07:32 EDT 2007


Hi Kent,

Bug fixes are welcome during the Freezing period.

But...
we should build some confidence on this being an actual fix.

If you could set up a test, we will be happy to include it
before the release.


    Thanks


       Luis


---------------------
kent williams wrote:
> Richard Beare posted to the Developer's List that he was getting all-black
> probability images with the ImageViewer app.
> 
> He sent me a NIfTI file that illustrates the problem is this: The pixel type
> is char, but the slope is 0.003922. In other words the pixels on disk are in
> the range 0..255 but the pixel values should be in the range 0.0..1.0.
> 
> The only fix I can see is this:
> 
> 1. In ReadImageInformation, record the actual on-disk pixel type, but report
> FLOAT in m_ComponentType.  This will force ImageFileReader to allocate it's
> pixel buffer as float, not char.
> 
> 2. After reading the char data from disk, upcast each pixel to float and
> copy to the float buffer.  Then the pixel value Rescale function will work
> in floating point.
> 
> There really isn't any alternative to this that I can see. Obviously at
> least one person is seeing these char + rescale to 0.0..1.0 files in the
> wild, and reading them in as all zeros isn't very helpful.
> 
> This is perhaps too late for 3.4, but if the gatekeepers think this change
> is important enough to slip in, I can send the changes and add a regression
> test.  Unfortunately I'll have to write out a test file with niftilib and
> not ITK, since ITK would have no way to write out such a file.
> 
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk.org
> http://www.itk.org/mailman/listinfo/insight-developers
> 


More information about the Insight-developers mailing list