[Insight-developers] ImageSeriesWriter + GDCMImageIO

Bill Lorensen bill.lorensen at gmail.com
Thu Dec 3 08:07:11 EST 2009


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
>


More information about the Insight-developers mailing list