[Insight-users] Get/SetMetaDataDictionaryArray() does not work properly

Thomas Fejes tfejes at students.unibe.ch
Fri Oct 26 06:43:11 EDT 2012


Hello everybody,

I'm facing a problem regarding the manipulation of the Meta Data Dictionary
in DICOM files:

 

The task is to register/resample a DICOM series. Based on this, the number
of slides changes. So each slide dictionary has to be processed as well. 

The array with the new information is passed over to the writer by the
following function:

 

writer->SetMetaDataDictionaryArray(&outputArray).

 

The function corrupts the series somehow, so that the z-Voxel
spacing/Coordinates are wrong. (ITK-SNAP just puts 1).

 

Even if I just read and write the DICOM-Series and use this function, the
failure appears:

 

seriesWriter->SetInput(reader->GetOutput());

 

seriesWriter->SetMetaDataDictionaryArray(
reader->GetMetaDataDictionaryArray());

 

seriesWriter->Update();

 

 

I tried to reread the corrupted series and resample it, but it did not
worked: 

 

reader:                 Original files.

reader1:              Corrupted series.

seriesWriter1:   Writer for the resampled image.
(GetMetaDataDictionaryArray() not used)

 

typedef itk::ResampleImageFilter <ImageType,ImageType> FilterType;

FilterType::Pointer filter=FilterType::New();

      

typedef itk::AffineTransform < double,3 > TransformType;

TransformType::Pointer transform = TransformType::New();

transform->SetIdentity();

 

typedef itk::NearestNeighborInterpolateImageFunction <ImageType, double >
InterpolatorType;

InterpolatorType::Pointer interpolator = InterpolatorType::New();

      

      

ImageType *MoveImg=reader1->GetOutput();

ImageType *FixImg=reader->GetOutput();

      

filter->SetInput(MoveImg);

 

/*filter->SetReferenceImage(FixImg);

filter->UseReferenceImageOn();*/

 

transform->SetIdentity();

filter->SetTransform(transform);

 

//filter->SetInterpolator( interpolator );

 

filter->SetDefaultPixelValue(0);

filter->SetOutputSpacing(FixImg->GetSpacing());

filter->SetOutputOrigin(FixImg->GetOrigin());

filter->SetSize(FixImg->GetLargestPossibleRegion().GetSize());

 

//filter->SetOutputDirection(FixImg->GetDirection());

 

filter->Update();

 

seriesWriter1->SetInput(filter->GetOutput());

 

 

I tried as well to set the spacing at the ImageIOType
(gdcmIO->SetSpacing(2,6.6)). Did not help.

 

 

 

 

What I have found:

 

http://www.itk.org/Wiki/ITK/Examples/DICOM/ResampleDICOM shows the error as
well.

 

https://itk.icts.uiowa.edu/jira/browse/ITK-182  Is there a batch or work
around ??

 

 

 

Some search results:

 

http://www.itk.org/pipermail/insight-users/2008-November/027993.html

 

http://www.itk.org/pipermail/insight-users/2005-September/014908.html

 

http://www.itk.org/pipermail/insight-users/2005-August/014314.html

 

http://www.itk.org/pipermail/insight-users/2010-January/035020.html

 

http://www.itk.org/pipermail/insight-users/2008-June/026238.html

 

http://www.itk.org/pipermail/insight-users/2012-August/045600.html

 

http://www.itk.org/pipermail/insight-users/2010-April/036334.html

 

 

Thank you in advance.

 

 

Best Regards

Thomas

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20121026/c296ef9e/attachment.htm>


More information about the Insight-users mailing list