17 #ifndef __itkRGBPixel_txx
18 #define __itkRGBPixel_txx
20 #include "itkNumericTraits.h"
33 BaseArray::operator=(r);
48 for(
unsigned int i=0; i<3; i++)
50 result[i] = (*this)[i] + r[i];
64 for(
unsigned int i=0; i<3; i++)
66 result[i] = (*this)[i] - r[i];
81 for(
unsigned int i=0; i<3; i++)
96 for(
unsigned int i=0; i<3; i++)
112 for(
unsigned int i=0; i<3; i++)
114 result[i] = (*this)[i] * r;
128 for(
unsigned int i=0; i<3; i++)
130 if((*
this)[i] != r[i])
146 for(
unsigned int i=0; i<3; i++)
148 if((*
this)[i] >= r[i])
164 const double luminance =
165 0.30 * this->GetRed() +
166 0.59 * this->GetGreen() +
167 0.11 * this->GetBlue();
174 template<
class TComponent>
176 operator<<(std::ostream& os,const RGBPixel<TComponent> & c )
178 os << static_cast<typename NumericTraits<TComponent>::PrintType>(c[0]) <<
" ";
179 os << static_cast<typename NumericTraits<TComponent>::PrintType>(c[1]) <<
" ";
180 os << static_cast<typename NumericTraits<TComponent>::PrintType>(c[2]);
188 template<
class TComponent>
195 is >> red >> green >> blue;