[Insight-developers] ITK_Origin + MetaDataDictionaryArray + GDCM2
Daniele E. Domenichelli
daniele.domenichelli at gmail.com
Fri Oct 2 12:47:46 EDT 2009
Hello,
Using GDCM 1 user can set origin of the image adding to the
MetaDataDictionaryArray the entry (0020|0037) because there is a check:
<from itkGDCMImageIO.cxx>
if( !header->GetValEntry(0x0020,0x0032 ) )
{
[write origin in str]
header->InsertValEntry(str.str(),0x0020,0x0032);
}
Using GDCM 2 origin are calculated and tags are created by gdcm::image
image.SetOrigin(0, m_Origin[0] );
image.SetOrigin(1, m_Origin[1] );
image.SetOrigin(2, m_Origin[2] );
If you are writing a 3D image to 2D DICOM slices, m_Origin[2] is always
0 unless ITK_Origin tag is set in MetaDataDictionary (in this case the
values are read from this tag)
But in ImageSeriesWriter, if you set a MetaDataDictionaryArray, this tag
is not set (see also bug 0006637)
<from itkImageSeriesWriter.txx>
if( m_MetaDataDictionaryArray )
{
[...]
}
else
{
if( m_ImageIO )
{
[...]
EncapsulateMetaData<...>(dictionary , ITK_Origin, ... );
EncapsulateMetaData<...>(dictionary , ITK_Spacing, ... );
EncapsulateMetaData<...>(dictionary , ITK_NumberOfDimensions, ... );
}
}
So it's not possible to set m_Origin[2].
Is there a reason because ITK_Origin, ITK_Spacing and
ITK_NumberOfDimensions are not added to each MetaDataDictionary by
ImageSeriesWriter? (I found that if those tags are added to each
MetaDataDictionary in the array, generated DICOM contains the correct
values for Origin/Image Position (Patient).)
Regards,
Daniele E. Domenichelli
More information about the Insight-developers
mailing list