00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkComposeRGBAImageFilter.h,v $ 00005 Language: C++ 00006 Date: $Date: 2008-07-08 16:20:31 $ 00007 Version: $Revision: 1.1 $ 00008 00009 Copyright (c) Insight Software Consortium. All rights reserved. 00010 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 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 00091 protected: 00092 ComposeRGBAImageFilter() {} 00093 virtual ~ComposeRGBAImageFilter() {} 00094 00095 private: 00096 ComposeRGBAImageFilter(const Self&); //purposely not implemented 00097 void operator=(const Self&); //purposely not implemented 00098 00099 00100 }; 00101 00102 } // end namespace itk 00103 00104 00105 #endif 00106