<div dir="ltr"><div><div><div>Constantine,<br><br>You found a bug in itk's dicom IO. I'll report it and prepare a patch to fix it for future users.<br><br>As a workaround, which should work for ITK 3 and ITK4 and hopefully after I fix the bug:<br>
<br></div>1) If you want to retain the input dicom entries, you should create a GDCMImageIO and use it for both the input and output.<br></div>2) To work around the itk dicom bug, add these lines AFTER the stats filter:<br>
// Set rescale slope and intercept to 1 and 0<br> imageReader0->Update();<br> typedef itk::MetaDataDictionary DictionaryType;<br> DictionaryType & dict = imageReader0->GetOutput()->GetMetaDataDictionary();<br>
itk::EncapsulateMetaData<std::string>( dict, "0028|1052", "0.0");<br> itk::EncapsulateMetaData<std::string>( dict, "0028|1053", "1.0");<br><br></div>NOTE: You need to #include "itkMetaDataObject.h"<br>
<div class="gmail_extra"><br></div><div class="gmail_extra">I've attached the your program with all of these changes. Thanks for your patience,<br><br>Bill<br><br>
</div></div>