[Insight-users] 16-bit IO in ITK

Emma Ryan eryanvtk at yahoo.com
Fri Jul 6 18:11:46 EDT 2007


Hello Dan,

  Thank you for your reply. I did read the manual, but it talks of conversions in general and I wanted some info on whether the 'extra' 8 bits were dropped off from LSB or MSB.  I guess this is more of a C++ thing than an ITK thing. 

 Thank you for your suggestions, though. I guess its the only way I can ensure less information loss.

Emma

----- Original Message ----
From: Dan Mueller <d.mueller at qut.edu.au>
To: Emma Ryan <eryanvtk at yahoo.com>
Cc: insight-users at itk.org
Sent: Friday, July 6, 2007 5:55:08 PM
Subject: Re: [Insight-users] 16-bit IO in ITK




  
  

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

  








       
____________________________________________________________________________________
Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games.
http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20070706/da9fead9/attachment.htm


More information about the Insight-users mailing list