[Insight-developers] The 3D vs 2D ImageSeriesWriter mess (Was Re: ImageSeriesWriter + GDCMImageIO)
Mathieu Malaterre
mathieu.malaterre at gmail.com
Thu Dec 3 09:15:06 EST 2009
I reverted all my changes. It was making another test fails.
$ cvs ci -m"BUG: 0009622 reverting proposed patch until fixed by
original bug reporter. ITK behavior is to simply discard 3D direction
information when writing a Series of 2D images out of a 3D image. This
cannot be seen in other format than DICOM, since other format are ok
with 2D raster image in 2D world, while DICOM wants 2D raster in 3D
world."
Committer: Mathieu Malaterre <mathieu.malaterre at gmail.com>
Running style check
Running style check
Processing itkGDCMImageIO.cxx
Running style check
Processing itkIOCommon.cxx
Running style check
Processing itkIOCommon.h
Running style check
Processing itkImageIOBase.cxx
Running style check
Processing itkImageSeriesWriter.txx
/cvsroot/Insight/Insight/Code/IO/itkGDCMImageIO.cxx,v <--
Code/IO/itkGDCMImageIO.cxx
new revision: 1.170; previous revision: 1.169
/cvsroot/Insight/Insight/Code/IO/itkIOCommon.cxx,v <-- Code/IO/itkIOCommon.cxx
new revision: 1.32; previous revision: 1.31
/cvsroot/Insight/Insight/Code/IO/itkIOCommon.h,v <-- Code/IO/itkIOCommon.h
new revision: 1.30; previous revision: 1.29
/cvsroot/Insight/Insight/Code/IO/itkImageIOBase.cxx,v <--
Code/IO/itkImageIOBase.cxx
new revision: 1.88; previous revision: 1.87
/cvsroot/Insight/Insight/Code/IO/itkImageSeriesWriter.txx,v <--
Code/IO/itkImageSeriesWriter.txx
new revision: 1.36; previous revision: 1.35
On Thu, Dec 3, 2009 at 3:03 PM, Mathieu Malaterre
<mathieu.malaterre at gmail.com> wrote:
> Ok, I made another attempt:
>
> $ cvs ci -m"BUG: Attempt to fix segfault. Indeed ITK_Direction comes
> in lexical order before ITK_NumberOfDimensions. So changed the name to
> ITK_ZDirection. Modify the tricky part of itkImageIOBase.cxx where a
> 3D images was filled from a 2D image, we cannot copy more value in
> SetDirection than what is stored in 'direction'."
> ? Code/IO/.itkGDCMImageIO.cxx.swp
> Committer: Mathieu Malaterre <mathieu.malaterre at gmail.com>
> Running style check
> Running style check
> Processing itkGDCMImageIO.cxx
>
>
>
> Running style check
> Processing itkIOCommon.cxx
>
>
>
> Running style check
> Processing itkIOCommon.h
>
>
>
> Running style check
> Processing itkImageIOBase.cxx
>
>
>
> Running style check
> Processing itkImageSeriesWriter.txx
>
>
>
> /cvsroot/Insight/Insight/Code/IO/itkGDCMImageIO.cxx,v <--
> Code/IO/itkGDCMImageIO.cxx
> new revision: 1.169; previous revision: 1.168
> /cvsroot/Insight/Insight/Code/IO/itkIOCommon.cxx,v <-- Code/IO/itkIOCommon.cxx
> new revision: 1.31; previous revision: 1.30
> /cvsroot/Insight/Insight/Code/IO/itkIOCommon.h,v <-- Code/IO/itkIOCommon.h
> new revision: 1.29; previous revision: 1.28
> /cvsroot/Insight/Insight/Code/IO/itkImageIOBase.cxx,v <--
> Code/IO/itkImageIOBase.cxx
> new revision: 1.87; previous revision: 1.86
> /cvsroot/Insight/Insight/Code/IO/itkImageSeriesWriter.txx,v <--
> Code/IO/itkImageSeriesWriter.txx
> new revision: 1.35; previous revision: 1.34
>
>
> If this creates more problem, I'll revert both patches.
>
> Thanks
>
> On Thu, Dec 3, 2009 at 2:07 PM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
>> Mathieu,
>>
>> But now 3 tests are failing:
>> http://www.cdash.org/CDash/viewTest.php?onlyfailed&buildid=485280
>>
>> Bill
>>
>> On Thu, Dec 3, 2009 at 6:37 AM, Mathieu Malaterre
>> <mathieu.malaterre at gmail.com> wrote:
>>> On Wed, Sep 30, 2009 at 3:44 PM, Daniele E. Domenichelli
>>> <daniele.domenichelli at gmail.com> wrote:
>>>> Mathieu Malaterre wrote:
>>>>>> 2) When I read a DICOM set as a volume that has direction cosines
>>>>>> written as:
>>>>>>
>>>>>> Ax\Ay\Az\Bx\By\Bz
>>>>>>
>>>>>> these values are stored in a 3x3 matrix as:
>>>>>>
>>>>>> Ax Bx Cx
>>>>>> Ay By Cy (where C=AxB)
>>>>>> Az Bz Cz
>>>>>>
>>>>>> When I write back this volume as 2D DICOM, direction cosines are:
>>>>>>
>>>>>> Ax\Bx\Cx\Ay\By\Cy
>>>>>>
>>>>>>
>>>>>> The second attached file (GDCMDirectionCosines.diff) should correct this
>>>>>> behaviour. (I tested this only for GDCM 2)
>>>>>
>>>>> This is exactly the opposite of bug 0007748 which was recently applied
>>>>> to CVS HEAD
>>>>> http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/IO/itkGDCMImageIO.cxx?root=Insight&r1=1.161&r2=1.162
>>>>
>>>>
>>>> Ok now I understand what happened:
>>>>
>>>> With the first patch (ITK_Direction.diff) I wrote m_Direction in this way:
>>>>
>>>>
>>>> ---
>>>>
>>>> ExposeMetaData< DoubleMatrixType >( dict, key, directionMatrix );
>>>> for(int i = 0; i<3; i++)
>>>> for(int j = 0; j<3; j++)
>>>> m_Direction[i][j]=directionMatrix[i][j];
>>>>
>>>> ---
>>>>
>>>> but reading in the discussion of bug #7748 I understand that
>>>>
>>>>> The short hand explanation should be that the member m_Direction of
>>>>> itk::GDCMImageIO (inherited from itk::ImageIOBase) is a vector that
>>>>> points to vectors, where the first vector contains the direction
>>>>> cosines of the image rows, the second the direction cosines of the
>>>>> image columns and the third contains the direction cosines of the
>>>>> image slices. So, m_Direction[0][0], m_Direction[0][1],
>>>>> m_Direction[0][2] are the direction cosines of the image rows.
>>>>> itk::GDCMImageIO::m_Direction stores the direction cosines as rows.
>>>>
>>>> Then m_Direction is transposed and should be written in this way:
>>>>
>>>> ---
>>>>
>>>> ExposeMetaData< DoubleMatrixType >( dict, key, directionMatrix );
>>>> for(int i = 0; i<3; i++)
>>>> for(int j = 0; j<3; j++)
>>>> m_Direction[j][i]=directionMatrix[i][j];
>>>>
>>>> ---
>>>>
>>>> I attached a new file to bug #9622
>>>
>>> I applied your proposed patch : ITK_Direction.diff (and not
>>> ITK_Direction2.diff). Thanks !
>>>
>>> $ cvs ci -m"BUG: 0009622 Thanks to Daniele E. Domenichelli for
>>> providing the patch"
>>>
>>> ~/Kitware/Insight
>>> Committer: Mathieu Malaterre <mathieu.malaterre at gmail.com>
>>> Running style check
>>> Running style check
>>> Processing itkGDCMImageIO.cxx
>>>
>>>
>>>
>>> Running style check
>>> Processing itkIOCommon.cxx
>>>
>>>
>>>
>>> Running style check
>>> Processing itkIOCommon.h
>>>
>>>
>>>
>>> Running style check
>>> Processing itkImageSeriesWriter.txx
>>>
>>>
>>>
>>> /cvsroot/Insight/Insight/Code/IO/itkGDCMImageIO.cxx,v <--
>>> Code/IO/itkGDCMImageIO.cxx
>>> new revision: 1.168; previous revision: 1.167
>>> /cvsroot/Insight/Insight/Code/IO/itkIOCommon.cxx,v <-- Code/IO/itkIOCommon.cxx
>>> new revision: 1.30; previous revision: 1.29
>>> /cvsroot/Insight/Insight/Code/IO/itkIOCommon.h,v <-- Code/IO/itkIOCommon.h
>>> new revision: 1.28; previous revision: 1.27
>>> /cvsroot/Insight/Insight/Code/IO/itkImageSeriesWriter.txx,v <--
>>> Code/IO/itkImageSeriesWriter.txx
>>> new revision: 1.34; previous revision: 1.33
>>>
>>>
>>> --
>>> Mathieu
>>> _______________________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Kitware offers ITK Training Courses, for more information visit:
>>> http://kitware.com/products/protraining.html
>>>
>>> Please keep messages on-topic and check the ITK FAQ at:
>>> http://www.itk.org/Wiki/ITK_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.itk.org/mailman/listinfo/insight-developers
>>>
>>
>
>
>
> --
> Mathieu
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-developers
>
--
Mathieu
More information about the Insight-developers
mailing list