[Insight-developers] Trying to load 2D images in coronal or sagittal orientation always throws exception in ITK-3.10.1!

Ivan Macia imacia at vicomtech.org
Sun Jan 25 07:01:47 EST 2009


Dear all,

Since version 3.10.1 (and probably 3.10) I am unable to load a single slice
from a 3D coronal or sagittal volume (we do this for previewing or loading,
without actually loading the whole volume). ImageBase
::ComputeIndexToPhysicalPointMatrices() complains that the determinant is
zero.

This seems to be related to the fact that for a 2D image, m_Direction is 2x2
where it should be 3x3. It seems that previous versions didn't throw an
exception so they were working anyway.

Having a deeper look, I try to load an image where ImageIO (GDCMImageIO)
reads the following for the direction:

0.252   0.968    0.0
0.0       0.0     -1.0
-0.0968 0.252   0.0

However, when converting from the direction stored in ImageIO to
ImageBase::m_Direction (see  ImageFileReader::GenerateOutputInformation() )
the resulting matrix is

0.252 0.968
0.0     0.0

For this, the present code in
ImageBase::ComputeIndexToPhysicalPointMatrices() and
Image::ComputeIndexToPhysicalPointMatrices() throws an exception because the
determinant is zero

 if (vnl_determinant(this->m_Direction.GetVnlMatrix()) == 0.0)
    {
    itkExceptionMacro(<< "Bad direction, determinant is 0. Direction is " <<
this->m_Direction);
    }

This is quite critical because we cannot make our software work with
ITK-3.10 and above without changing this code. Either our exception handling
or Qt's is always catching this exception and we cannot continue with the
loading.

I have seen a discussion about this in Mantis issue [0005573]:
"Image::DirectionType should be Nx3 rather than NxN", however the discussion
was centered on 4D images. IMHO, leaving the 4D world apart, a single slice
of a volume lies in a 3D world so m_Direction should be 3x3.

Thanks in advance for your help

Iván
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20090125/6d763ecd/attachment.htm>


More information about the Insight-developers mailing list