[Insight-users] CastImageFilter Error (Signed Short -> Unsigned Char)
Bradley Lowekamp
blowekamp at mail.nih.gov
Sat Aug 24 09:48:24 EDT 2013
Hello,
The cast filter just does a naive C++ cast ( as the name implies ), so if the range of the input pixels exceed that of the output the results are defined by C++ casting. In this case it would just be the lower byte of bits from the input.
If you would like to scale the input as you are converting it you can look into the RescaleIntensity or IntensityWindowing filters. There is also the Clamp filter too.
There should be a variety of example of these filters around in the different example projects.
Brad
On Aug 23, 2013, at 4:51 PM, Antonio Calabrese <calantoanto at gmail.com> wrote:
> Hi Everyone,
> I am trying to convert an Image from one type to another using ITK's class
> CastImageFilter.
> Usually i never met issues when i used it, but now i would convert an signed
> short image to an unsigned char image, but the CastImageFilter fails and it
> return me an image that is like an only noisy image.
> Why?
> Can't i convert a PixelType signed short (int16) to unsigned char (uint8)?
>
>
>
>
> --
> View this message in context: http://itk-users.7.n7.nabble.com/CastImageFilter-Error-Signed-Short-Unsigned-Char-tp32246.html
> Sent from the ITK - Users mailing list archive at Nabble.com.
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
More information about the Insight-users
mailing list