[Insight-developers] NumericTraits for RGBPixel

Emmanuel Christophe emmanuel.christophe at gmail.com
Thu Apr 8 10:57:42 EDT 2010


Hi,

Is there any reason (backward compatibility?) why the PrintType trait
for RGBPixel is defined as:

typedef Self PrintType;

instead of:

typedef  RGBPixel<ElementPrintType> PrintType;

???

I would expect the PrintType to be consistent with the trait of the
element type. With the current definition:
std::cout << static_cast<typename itk::NumericTraits<PixelType>::PrintType>(v);
works fine with a PixelType defined as char (the char is converted to
int before printing), but it doesn't work for a PixelType defined as
RGBPixel<char> (it outputs characters like ÿ ÿ ÿ).

This is the same for the NumericTraits of the RGBAPixel.

Emmanuel


More information about the Insight-developers mailing list