itkAddImageFilter.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkAddImageFilter_h
00018 #define __itkAddImageFilter_h
00019
00020 #include "itkBinaryFunctorImageFilter.h"
00021 #include "itkNumericTraits.h"
00022
00023
00024 namespace itk
00025 {
00026
00059 namespace Functor {
00060
00061 template< class TInput1, class TInput2=TInput1, class TOutput=TInput1>
00062 class Add2
00063 {
00064 public:
00065 typedef typename NumericTraits< TInput1 >::AccumulateType AccumulatorType;
00066 Add2() {};
00067 ~Add2() {};
00068 bool operator!=( const Add2 & ) const
00069 {
00070 return false;
00071 }
00072 bool operator==( const Add2 & other ) const
00073 {
00074 return !(*this != other);
00075 }
00076 inline TOutput operator()( const TInput1 & A, const TInput2 & B)
00077 {
00078 const AccumulatorType sum = A;
00079 return static_cast<TOutput>( sum + B );
00080 }
00081 };
00082
00083 }
00084 template <class TInputImage1, class TInputImage2=TInputImage1, class TOutputImage=TInputImage1>
00085 class ITK_EXPORT AddImageFilter :
00086 public
00087 BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage,
00088 Functor::Add2<
00089 typename TInputImage1::PixelType,
00090 typename TInputImage2::PixelType,
00091 typename TOutputImage::PixelType> >
00092
00093
00094 {
00095 public:
00097 typedef AddImageFilter Self;
00098 typedef BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage,
00099 Functor::Add2<
00100 typename TInputImage1::PixelType,
00101 typename TInputImage2::PixelType,
00102 typename TOutputImage::PixelType> > Superclass;
00103
00104 typedef SmartPointer<Self> Pointer;
00105 typedef SmartPointer<const Self> ConstPointer;
00106
00108 itkNewMacro(Self);
00109
00111 itkTypeMacro(AddImageFilter,
00112 BinaryFunctorImageFilter);
00113
00114 #ifdef ITK_USE_CONCEPT_CHECKING
00115
00116 itkConceptMacro(Input1Input2OutputAdditiveOperatorsCheck,
00117 (Concept::AdditiveOperators<typename TInputImage1::PixelType,
00118 typename TInputImage2::PixelType,
00119 typename TOutputImage::PixelType>));
00120
00122 #endif
00123
00124 protected:
00125 AddImageFilter() {}
00126 virtual ~AddImageFilter() {}
00127
00128 private:
00129 AddImageFilter(const Self&);
00130 void operator=(const Self&);
00131
00132 };
00133
00134 }
00135
00136
00137 #endif
00138