[Insight-users] Filter for greyscale and rgb images

Bill Lorensen bill.lorensen at gmail.com
Fri Oct 3 16:00:16 EDT 2008


John,

Try:

PixelType pix = NumericTriats<PixelType>::ZeroValue();

Bill

On Sat, Sep 27, 2008 at 11:48 AM, John <dbgtjp at hotmail.com> wrote:
> hi,
>
> I'm writing a filter straightening an image across a defined line. New areas
> which result from straightening should be black.
>
> Now I've got the problem that this works fine with greyscale images, but I would
> also like to use the filter with RGB images.
> The problem is the following code:
>
> PixelType pix = 0;
>
> while(offset-- > 0)
> {
>  out.Set(pix);
>  ++out;
> }
>
> which results in:
> ACRLS/src/ibiaRetinalLayerStraighteningFilter.txx:133: error:
> conversion from
> 'int' to 'itk::RGBPixel<unsigned char>' is ambiguous
> /opt/itk-src/Code/Common/itkRGBPixel.h:77: note:
> candidates are:
> itk::RGBPixel<TComponent>::RGBPixel(const TComponent*)
> [with TComponent =
> unsigned char]
> /opt/itk-src/Code/Common/itkRGBPixel.h:72: note:
> itk::RGBPixel<TComponent>::RGBPixel(const TComponent&)
> [with TComponent =
> unsigned char]
>
> Is there a way to write code which can be handle both image types
> or do I have to check if the incoming image is an rgb image or
> greyscale image and use if else?
> If the seconds is the case, how can I check if the image is RGB or not?
>
> Thank you in advance.
> John
>
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>


More information about the Insight-users mailing list