[Insight-users] Image Intensities Changed During DICOM Read-Write-Read in ITK 3.20 vs. ITK 4.4.1

Bill Lorensen bill.lorensen at gmail.com
Fri Aug 16 14:13:42 EDT 2013


Constantine,

You found a bug in itk's dicom IO. I'll report it and prepare a patch to
fix it for future users.

As a workaround, which should work for ITK 3 and ITK4 and hopefully after I
fix the bug:

1) If you want to retain the input dicom entries, you should create a
GDCMImageIO and use it for both the input and output.
2) To work around the itk dicom bug, add these lines AFTER the stats filter:
  // Set rescale slope and intercept to 1 and 0
  imageReader0->Update();
  typedef itk::MetaDataDictionary   DictionaryType;
  DictionaryType & dict =
imageReader0->GetOutput()->GetMetaDataDictionary();
  itk::EncapsulateMetaData<std::string>( dict, "0028|1052", "0.0");
  itk::EncapsulateMetaData<std::string>( dict, "0028|1053", "1.0");

NOTE: You need to #include "itkMetaDataObject.h"

I've attached the your program with all of these changes. Thanks for your
patience,

Bill
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130816/c51fdd0a/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DICOMTest.cxx
Type: application/octet-stream
Size: 3034 bytes
Desc: not available
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130816/c51fdd0a/attachment-0001.obj>


More information about the Insight-users mailing list