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

Kent Williams kent at psychiatry.uiowa.edu
Wed Feb 8 14:26:35 EST 2006


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.



More information about the Insight-developers mailing list