00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkComposeRGBImageFilter_h
00018 #define __itkComposeRGBImageFilter_h
00019
00020 #include "itkTernaryFunctorImageFilter.h"
00021 #include "itkRGBPixel.h"
00022
00034 namespace itk
00035 {
00036
00037 namespace Function {
00038
00039 template< class TInput >
00040 class ComposeRGB
00041 {
00042 public:
00043 typedef RGBPixel<TInput> OutputType;
00044 ComposeRGB() {}
00045 ~ComposeRGB() {}
00046 bool operator!=( const ComposeRGB & ) const
00047 {
00048 return false;
00049 }
00050 bool operator==( const ComposeRGB & other ) const
00051 {
00052 return !(*this != other);
00053 }
00054 inline OutputType operator()( const TInput & R,
00055 const TInput & G,
00056 const TInput & B)
00057 {
00058 OutputType rgbPixel;
00059 rgbPixel.Set( R, G, B);
00060 return rgbPixel;
00061 }
00062 };
00063 }
00064
00065 template <typename TInputImage,
00066 typename TOutputImage=
00067 Image< RGBPixel< ITK_TYPENAME TInputImage::PixelType >,
00068 ::itk::GetImageDimension<TInputImage>::ImageDimension > >
00069 class ITK_EXPORT ComposeRGBImageFilter :
00070 public
00071 TernaryFunctorImageFilter<TInputImage,TInputImage,
00072 TInputImage,TOutputImage,
00073 Function::ComposeRGB< ITK_TYPENAME TInputImage::PixelType > >
00074 {
00075 public:
00077 typedef ComposeRGBImageFilter Self;
00078 typedef TernaryFunctorImageFilter<
00079 TInputImage,TInputImage,
00080 TInputImage,TOutputImage,
00081 Function::ComposeRGB<
00082 ITK_TYPENAME TInputImage::PixelType > >
00083 Superclass;
00084 typedef SmartPointer<Self> Pointer;
00085 typedef SmartPointer<const Self> ConstPointer;
00086
00087 typedef typename Superclass::OutputImageType OutputImageType;
00088
00090 itkNewMacro(Self);
00091
00093 itkTypeMacro(ComposeRGBImageFilter,
00094 TernaryFunctorImageFilter);
00095
00096 protected:
00097 ComposeRGBImageFilter() {}
00098 virtual ~ComposeRGBImageFilter() {}
00099
00100 private:
00101 ComposeRGBImageFilter(const Self&);
00102 void operator=(const Self&);
00103
00104
00105 };
00106
00107 }
00108
00109
00110 #endif
00111