[Insight-users] Filter for greyscale and rgb images

John dbgtjp at hotmail.com
Sat Sep 27 11:48:19 EDT 2008


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




More information about the Insight-users mailing list