[Insight-users] 16-bit -> 8-bit pixels

Bill Lorensen bill.lorensen at gmail.com
Tue Sep 13 23:37:15 EDT 2011


When you declare your image series reader use unsigned char as the type. The
reader will produce the output type regardless of the actual type in the
files themselves. It does so with a simple cast. This can be dangerous, but
in your case, you know the values are less than 255.

On Tue, Sep 13, 2011 at 11:29 PM, Gib Bogle <g.bogle at auckland.ac.nz> wrote:

> I'm reading a set of 2D tiff images and writing a 3D tiff (essentially the
> example IO/ImageSeriesReadWrite.cxx).  The 2D tiffs have 16-bit pixels, but
> the pixel values are all less than 255.  I want the output file to be 8-bit.
>  How should I do the conversion (the example ImageReadCastWrite uses
> RescaleIntensityImageFilter to convert between different pixel formats, but
> I do not want to rescale the values).
> ______________________________**_______
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/**opensource/opensource.html<http://www.kitware.com/opensource/opensource.html>
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/**products/protraining.html<http://www.kitware.com/products/protraining.html>
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_**FAQ <http://www.itk.org/Wiki/ITK_FAQ>
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/**listinfo/insight-users<http://www.itk.org/mailman/listinfo/insight-users>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110913/6faa43d8/attachment.htm>


More information about the Insight-users mailing list