00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkComposeRGBAImageFilter_h
00018 #define __itkComposeRGBAImageFilter_h
00019
00020 #include "itkNaryFunctorImageFilter.h"
00021 #include "itkRGBAPixel.h"
00022 #include "itkNumericTraitsRGBAPixel.h"
00023
00040 namespace itk
00041 {
00042
00043 namespace Functor {
00044
00045 template< class TInput >
00046 class ComposeRGBA
00047 {
00048 public:
00049 typedef RGBAPixel<TInput> OutputType;
00050 ComposeRGBA() {}
00051 ~ComposeRGBA() {}
00052 bool operator!=( const ComposeRGBA & ) const
00053 {
00054 return false;
00055 }
00056 bool operator==( const ComposeRGBA & other ) const
00057 {
00058 return !(*this != other);
00059 }
00060 inline OutputType operator()( const std::vector< TInput > & in )
00061 {
00062 OutputType pixel;
00063 pixel.Set( in[0], in[1], in[2], in[3] );
00064 return pixel;
00065 }
00066 };
00067 }
00068
00069 template <typename TInputImage,
00070 typename TOutputImage=
00071 Image< RGBAPixel< ITK_TYPENAME TInputImage::PixelType >,
00072 ::itk::GetImageDimension<TInputImage>::ImageDimension > >
00073 class ITK_EXPORT ComposeRGBAImageFilter :
00074 public
00075 NaryFunctorImageFilter<TInputImage,TOutputImage,
00076 Functor::ComposeRGBA< ITK_TYPENAME TInputImage::PixelType > >
00077 {
00078 public:
00080 typedef ComposeRGBAImageFilter Self;
00081 typedef NaryFunctorImageFilter<TInputImage,TOutputImage,
00082 Functor::ComposeRGBA<ITK_TYPENAME TInputImage::PixelType > > Superclass;
00083 typedef SmartPointer<Self> Pointer;
00084 typedef SmartPointer<const Self> ConstPointer;
00085
00086 typedef typename Superclass::OutputImageType OutputImageType;
00087
00089 itkNewMacro(Self);
00090
00092 itkTypeMacro(ComposeRGBAImageFilter, NaryFunctorImageFilter);
00093
00094 protected:
00095 ComposeRGBAImageFilter() {}
00096 virtual ~ComposeRGBAImageFilter() {}
00097
00098 private:
00099 ComposeRGBAImageFilter(const Self&);
00100 void operator=(const Self&);
00101
00102
00103 };
00104
00105 }
00106
00107
00108 #endif
00109