[Insight-developers] ImageSeriesWriter + GDCMImageIO

Daniele E. Domenichelli daniele.domenichelli at gmail.com
Tue Sep 29 10:22:31 EDT 2009


Hello,


I'm trying to read a 2D dicom set as a 3D volume, do something on this
volume, than write it back into a 2D DICOM set and I found 2 bugs:


1) When directional cosines are copied from 3D volume to 2D slices by
ImageSeriesWriter, only the upper-left 2x2 matrix can be copied, due to
the dimension of m_Direction matrix.
Then GDCMImageIO sets zeros in the missing values of the first 2 lines
of the matrix.

This is not a problem if the directional cosines matrix is the identity
matrix, otherwise DICOM tag (0020,0037) Image Orientation (Patient) of
the output DICOM files is not valid.

I suggest that an ITK_Direction entry containing Direction Matrix could
be added in MetaDataDictionary. In this way there is no need to change
the behaviour of this filter and ImageIOs have an easy way to access
this information.


The first attached file (ITK_Direction.diff) is a patch to add this
entry in MetaDataDictionary and to read this tag in GDCMImageIO


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)



Best Regards
 Daniele E. Domenichelli
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GDCMDirectionCosines.diff
Type: text/x-patch
Size: 1731 bytes
Desc: not available
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20090929/7a85ebaf/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ITK_Direction.diff
Type: text/x-patch
Size: 3873 bytes
Desc: not available
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20090929/7a85ebaf/attachment-0001.bin>


More information about the Insight-developers mailing list