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

Constantine Zakkaroff mnkz at leeds.ac.uk
Fri Oct 18 20:24:01 EDT 2013


Hi Bill,

It appears the bug with slope and intercept being processed incorrectly 
still shows up in ITK 4.4.2.

Is there an explanation why in the original DICOM file rescale slope is 
7.1, but in order to see the same image stats (min, max, etc.) it needs 
to be saved with the rescale slope value of 1.0?

Also, I believe I mentioned it a while ago, but there wasn't much 
feedback on this: some tag values get unexpected values. For example, 
compare the following tag values in the original DICOM file:

(0010,21C0) Pregnancy Status VR: US Length: 2 Value: 4
(0018,0088) Spacing Between Slices VR: DS Length: 4 Value: 17.0
(0018,1310) Acquisition Matrix VR: US Length: 8 Value: 0 144 144 0

and saved file:

(0010,21C0) Pregnancy Status VR: US Length: 2 Value: 52
(0018,0088) Spacing Between Slices VR: DS Length: 2 Value: 1
(0018,1310) Acquisition Matrix VR: US Length: 12 Value: 23600 13361 
23604 13361 23604 48

As suggested earlier, I use the same GDCMImageIO object for reading and 
writing.

Many thanks,
Constantine


On 16/08/2013 19:13, Bill Lorensen wrote:
> 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
>


More information about the Insight-users mailing list