[ITK] Bruker Format

Dženan Zukić dzenanz at gmail.com
Fri Feb 10 18:43:13 EST 2017


Hi Tobias,

reading is done in function void NiftiImageIO::Read(void *buffer) in
file C:\Dev\ITK-git\Modules\IO\NIFTI\src\itkNiftiImageIO.cxx

This function is supposed to read image data from disk into the given
buffer pointer. The data type of this buffer is of this->m_ComponentType.
In case that NIFTI reader detects it needs to do rescale/slope
transformation (in function ReadImageInformation), it says that
this->m_ComponentType=FLOAT, no matter what is the real component type on
disk. Then Read reads the image data, converts it to float, does
rescale/slope transformation in place (float to float).

Later ImageFileReader (which calls ImageIO::Read()) does C++ cast from
this->m_ComponentType into the type with which ImageFileReader was
instantiated.

Regards,
Dženan

On Fri, Feb 10, 2017 at 5:02 PM, Wood, Tobias <tobias.wood at kcl.ac.uk> wrote:

> Hello,
>
> I’ve made some progress on rewriting the Bruker code. I’m stuck on when
> the ImageIO classes should apply scalings/offsets.
>
> Bruker’s default data type is INT16. They store a scaling and offset that
> must be applied to the data. For whatever reason, the scaling tends to very
> small - about 1e-5. Hence a lot of values should be scaled down to < 1.
> Obviously, if this is done at INT16 precision then most of the data is
> rounded to zero and lost.
>
> I tried to copy the NifiIO class which also applies scaling (See lines 707
> onwarsds in itkNiftiImageIO.cxx). However - if I read this correctly, it is
> applying the scaling at the precision/datatype of the image file, not the
> PixelType requested by the itkImage template parameter to
> itkImageFileReader.
>
> At what point is the buffer read by the ImageIO classes converted to the
> PixelType of the requested itkImage? How do I supply the scaling and offset
> to this conversion?
>
> As always, I hope I’m missing something obvious.
> Thanks,
> Toby
>
> On 16/01/2017, 09:27, "Wood, Tobias" <tobias.wood at kcl.ac.uk> wrote:
>
>     >    In addition to Dženan's suggestion, the code could be cleaned
> up, moved out of the ITKReview module, and placed in its own module in the
> IO group. This will enable it to be automatically registered like the other
> ImageIOs.
>
>     Thanks Matt and Dženan, that’s what I was wondering. I will experiment
> with the code and submit a patch if I find time.
>
>     Best wishes,
>     Toby
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20170210/ab07d4c9/attachment-0001.html>


More information about the Community mailing list