[Insight-users] How to cast from RGB to short?

Michael Xanadu xanadu.michael at googlemail.com
Mon Aug 31 09:33:20 EDT 2009


Hi,

I've got a watershed filtered image processed by a colormapper. So it's an
image of type:

    typedef itk::RGBPixel<short>   RGBPixelType;
    typedef itk::Image<RGBPixelType, 2>    RGBImageType;

Now I want to filter that image with a connected threshold filter, because I
need it this way.
But ConnectedThresholdImageFilter can't process such RGB images.
I tryed to convert the image into a short type by using CastImageFilter,
too.
But I always get:

    error C2440: 'static_cast' : cannot convert from
'itk::RGBPixel<TComponent>' to 'short'

So how can I cast from RGB to short? Or how to filter a RGB image with a
connected threshold filter?


Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090831/44d4f8ae/attachment.htm>


More information about the Insight-users mailing list