00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkNaryAddImageFilter_h
00018 #define __itkNaryAddImageFilter_h
00019
00020 #include "itkNaryFunctorImageFilter.h"
00021 #include "itkNumericTraits.h"
00022
00023
00024 namespace itk
00025 {
00026
00056 namespace Functor {
00057
00058 template< class TInput, class TOutput >
00059 class Add1
00060 {
00061 public:
00062 typedef typename NumericTraits< TInput >::AccumulateType AccumulatorType;
00063 Add1() {}
00064 ~Add1() {}
00065 inline TOutput operator()( const TOutput & A, const TInput & B)
00066 {
00067 const AccumulatorType sum = A;
00068 return static_cast<TOutput>( sum + B );
00069 }
00070 bool operator != (const Add1&) const
00071 {
00072 return false;
00073 }
00074 };
00075 }
00076 template <class TInputImage, class TOutputImage>
00077 class ITK_EXPORT NaryAddImageFilter :
00078 public
00079 NaryFunctorImageFilter<TInputImage,TOutputImage,
00080 Functor::Add1< typename TInputImage::PixelType,
00081 typename TOutputImage::PixelType> >
00082 {
00083 public:
00085 typedef NaryAddImageFilter Self;
00086 typedef NaryFunctorImageFilter<TInputImage,TOutputImage,
00087 Functor::Add1< typename TInputImage::PixelType,
00088 typename TOutputImage::PixelType> > Superclass;
00089 typedef SmartPointer<Self> Pointer;
00090 typedef SmartPointer<const Self> ConstPointer;
00091
00093 itkNewMacro(Self);
00094
00095 protected:
00096 NaryAddImageFilter() {}
00097 virtual ~NaryAddImageFilter() {}
00098
00099 private:
00100 NaryAddImageFilter(const Self&);
00101 void operator=(const Self&);
00102
00103 };
00104
00105 }
00106
00107
00108 #endif