[Insight-users] AnalyzeIO and TIFFIO for 2D images (ITK 3.0)
Tom Vercauteren
tom.vercauteren at gmail.com
Tue Dec 26 09:58:35 EST 2006
Hi all,
I have been working with ITK 3.0 and had some problems using some IO
classes with 2D images. It seems that some code implicitly assumes
that the images are 3D.
For example in Code/IO/itkAnalyzeImageIO.cxx on line 1153, there is a call to
dirz = this->GetDirection(2)
which is then used for the SpatialOrientationAdapter.
Unfortunately, if the image is 2D, this does not work. I don't know
much about the Analyze format and how the spatial orientation is used
in ITK so I cannot provide a decent patch. For now, I use this
temporary solution in AnalyzeImageIO::WriteImageInformation:
if (this->GetNumberOfDimensions()>2)
{
Use the current ITK code to set this->m_hdr.hist.orient
}
else
{
this->m_hdr.hist.orient=itk::AnalyzeImageIO::ITK_ANALYZE_ORIENTATION_RIP_CORONAL;
}
This is of course a bad solution: it does not take into account the
orientation of the 2D image, I am not able to read it back using ITK
IO, but it allows me to write 2D analyse images and use it with
external programs.
For the TIFF IO, it seems that it always considers the images to be
3D. Indeed in Code/IO/itkTIFFImageIO.cxx on lines 1418 we test for
if(m_InternalImage->NumberOfPages>0)
to decide if the image is 3D. But a 2D image has one page not zero...
A similar problem could arise with the NumberOfTiles test.
Am I missing something here or should I report this in the bug tracker?
Best regards,
Tom Vercauteren
More information about the Insight-users
mailing list