[Insight-users] writing float dicom images

Mathieu Malaterre mathieu.malaterre at kitware.com
Thu Feb 15 11:23:36 EST 2007


Salut André,

a.bongers at mediri.com wrote:
> Hi,
> 
> I was trying to use the FileWriter to write a 2D DICOM image with float
> values.
> My rough procedure is:
> 1. create a 2D float image, and allocate it.
> 2. copy some values from another image into this image.
> 3. create a float file writer Object with the float image as input
> 4. set the filename to something with ending ".dcm"
> 5. update the writer
> 
> The problem is that the FileWriter crashes when I try this with my float
> image. An ERROR is caught which tells me: "DICOM does not support this
> component type". Can anyone tell me what this means ?

It means that the DICOM standard does not specify a way to store 
floating point pixel data.

> When I use unsigned short images and writer instead I have no problems at
> all.
> Is the writer not able to write float dicom images? Does DICOM support
> float images at all? Could it be that the bit depth for the file writer
> is set or taken wrongly ?  Do I possibly have to tell the fileWriter the
> bit depth explicitely (besides the declaration) ?
> 
> Would be really great if someone could give me a useful hint!

Writing floating point DICOM image can be tricky. The only way to 
achieve that is to rescale your image on let say (un)signed short pixel 
data and specify a good rescale/intercept slope (in general you will 
loose precision in this step).
 From the top of my head only RT allow 32bits images anyway, so for 
anything else you have to deal with the 16bits limitation :(

HTH,
-Mathieu


More information about the Insight-users mailing list