[Insight-users] 16-bit IO in ITK

Dan Mueller d.mueller at qut.edu.au
Fri Jul 6 17:55:08 EDT 2007


Hi Emma,

Please read the ITK Software Guide, in particular Chapter 7: Reading and 
Writing Image, and Section 6.3: Casting and Intensity Mapping:
    http://www.itk.org/ItkSoftwareGuide.pdf

If the pixel type your specify is not the same as the underlying pixel 
type on disk, then the ImageIO object uses a static_cast to convert the 
data, which can result in information loss if the given pixel type is 
too short. For example, if the data is signed short on disk and ranges 
from -1000 to +1000 (which is typical for CT images), then reading as 
unsigned char will result in information loss. However, if your data is 
signed short on disk and ranges from 50 to 200, then reading as unsigned 
char will be fine.

Assuming you have read a 16-bit image without information loss, there 
are a number of ways to 'convert' it to 8-bits -- depending on your 
requirements. Please note these methods also result in 'information 
loss', albeit in a somewhat more controlled manner. One possibility is 
to linearly rescale the values so that the minimum (eg. -1000) maps to 0 
and the maximum (eg. 1000) maps to 255. The 
itkRescaleIntensityImageFilter achieves this:
    
http://www.itk.org/Doxygen/html/classitk_1_1RescaleIntensityImageFilter.html

You may also be interested in the itkIntensityWindowingImageFilter which 
allows you to specify a focus window before rescaling:
     
http://www.itk.org/Doxygen/html/classitk_1_1IntensityWindowingImageFilter.html

HTH

Cheers, Dan


Emma Ryan wrote:
> Hi,
>
> Just wanted to add....
>
> If the dicom file were read as <unsigned char, 2>, how does it convert 
> the 16-bit to 8-bit ?
>
> How does ITK handle 16-bit data conversion to 8-bit ? For example : if 
> I were to read a dicom series (16-bit) as 'signed short 'and store it 
> as a volume in .vtk format using OutputPixelType <unsigned char, 3>, 
> how does the conversion take place ?
>
> Or this conversion not possible in ITK ?
>
> Thanks in advance,
> Emma
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20070707/be65946f/attachment.html


More information about the Insight-users mailing list