[Insight-developers] InsightApplications/ConvertBetweenFileFormats not working for DICOM images with slope/intercept

Marius Staring marius at isi.uu.nl
Thu Feb 9 07:32:43 EST 2006


In the current cvs version and also in 2.4.0 of the insightApplications 
I noticed that a small but important error was made when 
castconvertScalar2D.cxx was split into two compilation units.

castconvertScalar2D.cxx support conversion for (unsigned) char short and 
unsigned int, but castconvertScalar2DA.cxx does that too. That should of 
coarse be int, (unsigned) long, float and double. In the current 
situation these latter types are not supported for 2D.

Maybe someone can change that in the repository?

Regards,

Marius

Marius Staring wrote:
> The reason why I commented the float part out was because I thought 
> that GDCM did not support float types, but only doubles. Checking the 
> code I think I was wrong, however in the function 
> InternalReadImageInformation() there is no check for float pixeltypes, 
> only for (unsigned) char short int and double.
>
> So, the commenting out was intentional, and I am not sure if floats 
> are supported.
>
> Regards,
>
> Marius
>
> Kent Williams wrote:
>> ConvertBetweenFileFormats, in addition to being a useful example, is 
>> a very useful program to have around for use in shell scripts.  It 
>> does a good job job of converting between any ITK-supported file 
>> format, to any other ITK-supported file format.
>>
>> But, it was defeated by a DICOM data set that turned up here at 
>> Iowa.  ConvertBetweenFileFormats silently gives up the ghost without 
>> writing any output.
>>
>> This seemed mysterious until I poked around in itkGDCMImageIO.cxx and 
>> saw what it was doing to recover the input image data type.  In the 
>> case of integer data, if the slope is not 1.0 and/or the intercept is 
>> not 0.0, it promotes the ComponentType of the file to float, in order 
>> to allow the Pixel(X) = Slope * X + Intercept calculation to get 
>> reasonable results.
>>
>> This, unfortunately runs afoul of the DicomFileConverterScaler and 
>> DicomFileConverterScalerA functions that do the real work for 
>> ConvertBetweenFileFormats, because the code to convert from float to 
>> other data types was commented out.  I've just checked in a change 
>> that uncomments this code -- it looks as though the commenting-out 
>> was unintentional.
>>
>> _______________________________________________
>> Insight-developers mailing list
>> Insight-developers at itk.org
>> http://www.itk.org/mailman/listinfo/insight-developers
>>
>

-- 
Marius Staring
Image Sciences Institute
University Medical Centre Utrecht
Heidelberglaan 100, 3584 CX Utrecht, The Netherlands
phone: +31 (0)30 250 3186, fax: +31 (0)30 251 3399
marius at isi.uu.nl, http://www.isi.uu.nl/People/Marius



More information about the Insight-developers mailing list