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
00055
namespace Functor {
00056
00057
template<
class TInput1,
class TInput2,
class TOutput >
00058 class Add2
00059 {
00060
public:
00061 typedef typename NumericTraits< TInput1 >::AccumulateType
AccumulatorType;
00062 Add2() {};
00063 ~Add2() {};
00064 inline TOutput
operator()(
const TInput1 & A,
const TInput2 & B)
00065 {
00066
const AccumulatorType sum = A;
00067
return static_cast<TOutput>( sum + B );
00068 }
00069 };
00070
00071 }
00072
template <
class TInputImage1,
class TInputImage2,
class TOutputImage>
00073 class ITK_EXPORT AddImageFilter :
00074
public
00075
BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage,
00076 Functor::Add2<
00077 typename TInputImage1::PixelType,
00078 typename TInputImage2::PixelType,
00079 typename TOutputImage::PixelType> >
00080
00081
00082 {
00083
public:
00085 typedef AddImageFilter
Self;
00086
typedef BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage,
00087
Functor::Add2<
00088
typename TInputImage1::PixelType,
00089
typename TInputImage2::PixelType,
00090
typename TOutputImage::PixelType>
00091 >
Superclass;
00092 typedef SmartPointer<Self> Pointer;
00093 typedef SmartPointer<const Self> ConstPointer;
00094
00096
itkNewMacro(
Self);
00097
00098
protected:
00099 AddImageFilter() {}
00100 virtual ~AddImageFilter() {}
00101
00102
private:
00103 AddImageFilter(
const Self&);
00104
void operator=(
const Self&);
00105
00106 };
00107
00108 }
00109
00110
00111
#endif