[Insight-users] DicomSeriesReaderSeriesWriter.cxx doesnot write Image position Patient and image orientation patient Z values

Mathieu Malaterre mathieu.malaterre at gmail.com
Mon Jun 9 10:22:20 EDT 2008


On Sun, Jun 8, 2008 at 3:17 AM, Sachin Jambawalikar <sachinjam at gmail.com> wrote:
> Hi all,
>
>  I was trying to use the  DicomSeriesWriter.cxx examples in the
> Examples/IO directory to just read a dicom series and write it to a
> new directory.
> The series writer produces the dicom files fine but when you  see the
> dicom header the
> tags are wrong for example
>
> the original file tag values are :
>
> 0020,0032,Image Position Patient=
> -102.34347617253\-156.03754969686\-62.252762846648
> 0020,0037,Image Orientation (Patient)=
> 0.99587732553482\0.07696951180696\0.04800064116716\-0.0597707442939\0.95484501123428\-0.2910300195217
>
> and the tags for the generated dcm file is:
> 0020,0032,Image Position Patient= -102.343475\-156.037552\0.000000
> 0020,0037,Image Orientation (Patient)=
> 0.995877\-0.059771\0.000000\0.076970\0.954845\0.000000
>
> I guess the problem is in the itk:ImageSeriesWriter() which assumes
> the output datatype to be 2D and hence wihle writing the metadata info
> trunctates it only for  the image dimension
> I''ve used the
> inputdict=reader->GetMetaDataDictionaryArray() ;
> std::string imagepositionpatient;
> itk::ExposeMetaData<std::string>(*inputDict, "0020|0032",
> imagepositionpatient) and it reads the right values.
>
> I want to use this to read a dicom series  process the dicom series
> and  save this processed data as a new series in the study.
> The wrong  IPP and IOP tags causes  problems when viewing  this
> generated series in any pacs viewer when the study is loaded.
>
> Is there a way around this or am  I doing something wrong ??()
>
> Thanks
>
> Regards
> Sachin Jambawalikar
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>

Sachin,

  I have just patch ITK:
$ cvs ci -m"ENH: When used explicitely makes use of the
SetMetaDataDictionaryArray/GetMetaDataDictionaryArray we should use
information from the meta data dict. I did not handle the spacing,
since spacing in DICOM is also 2D thus it SHOULD match whatever
information was in the dict. Only Orienation and Position are 3D in a
2D image, which is difficult to handle in ITK"
/cvsroot/Insight/Insight/Code/IO/itkGDCMImageIO.cxx,v  <--  itkGDCMImageIO.cxx
new revision: 1.143; previous revision: 1.142

  If you could try that ASAP, I believe this fix the issue you are seeing.

  Steps:

$ make DicomSeriesReadSeriesWrite &&  ./bin/DicomSeriesReadSeriesWrite
../Insight/Testing/Data/Input/DicomSeries bla

$ dcmdump ../Insight/Testing/Data/Input/DicomSeries/Image00*.dcm | grep ImageOr
(0020,0037) DS [  1\ 0\ 0\ 0\0.466651\ -0.884442]       #  32, 6
ImageOrientationPatient
(0020,0037) DS [  1\ 0\ 0\ 0\0.466651\ -0.884442]       #  32, 6
ImageOrientationPatient
(0020,0037) DS [  1\ 0\ 0\ 0\0.466651\ -0.884442]       #  32, 6
ImageOrientationPatient

$ dcmdump bla/Image007* | grep ImageOri
(0020,0037) DS [  1\ 0\ 0\ 0\0.466651\ -0.884442]       #  32, 6
ImageOrientationPatient
(0020,0037) DS [  1\ 0\ 0\ 0\0.466651\ -0.884442]       #  32, 6
ImageOrientationPatient
(0020,0037) DS [  1\ 0\ 0\ 0\0.466651\ -0.884442]       #  32, 6
ImageOrientationPatient


And same for Position:

$ dcmdump bla/Image007* | grep ImagePos
(0020,0032) DS [-112\ -21.688\ 126.894]                 #  22, 3
ImagePositionPatient
(0020,0032) DS [-112\-20.2729\ 127.641]                 #  22, 3
ImagePositionPatient
(0020,0032) DS [-112\-18.8578\ 128.388]                 #  22, 3
ImagePositionPatient

$ dcmdump ../Insight/Testing/Data/Input/DicomSeries/Image00*.dcm | grep ImagePos
(0020,0032) DS [-112\ -21.688\ 126.894]                 #  22, 3
ImagePositionPatient
(0020,0032) DS [-112\-20.2729\ 127.641]                 #  22, 3
ImagePositionPatient
(0020,0032) DS [-112\-18.8578\ 128.388]                 #  22, 3
ImagePositionPatient


Please note, that you *HAVE TO* use the
SetMetaDataDictionaryArray/GetMetaDataDictionaryArray API for this to
works.

Thanks,
-- 
Mathieu


More information about the Insight-users mailing list