00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkSubtractImageFilter_h
00018 #define __itkSubtractImageFilter_h
00019
00020 #include "itkBinaryFunctorImageFilter.h"
00021
00022 namespace itk
00023 {
00024
00036 namespace Function {
00037
00038 template< class TInput1, class TInput2=TInput1, class TOutput=TInput1>
00039 class Sub2
00040 {
00041 public:
00042 Sub2() {}
00043 ~Sub2() {}
00044 bool operator!=( const Sub2 & ) const
00045 {
00046 return false;
00047 }
00048 bool operator==( const Sub2 & other ) const
00049 {
00050 return !(*this != other);
00051 }
00052 inline TOutput operator()( const TInput1 & A, const TInput2 & B)
00053 { return (TOutput)(A - B); }
00054 };
00055 }
00056
00057 template <class TInputImage1, class TInputImage2=TInputImage1, class TOutputImage=TInputImage1>
00058 class ITK_EXPORT SubtractImageFilter :
00059 public
00060 BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage,
00061 Function::Sub2<
00062 typename TInputImage1::PixelType,
00063 typename TInputImage2::PixelType,
00064 typename TOutputImage::PixelType> >
00065 {
00066 public:
00068 typedef SubtractImageFilter Self;
00069 typedef BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage,
00070 Function::Sub2< typename TInputImage1::PixelType,
00071 typename TInputImage2::PixelType,
00072 typename TOutputImage::PixelType> > Superclass;
00073 typedef SmartPointer<Self> Pointer;
00074 typedef SmartPointer<const Self> ConstPointer;
00075
00076
00078 itkNewMacro(Self);
00079
00081 itkTypeMacro(SubtractImageFilter,
00082 BinaryFunctorImageFilter);
00083
00084 #ifdef ITK_USE_CONCEPT_CHECKING
00085
00086 itkConceptMacro(Input1Input2OutputAdditiveOperatorsCheck,
00087 (Concept::AdditiveOperators<typename TInputImage1::PixelType,
00088 typename TInputImage2::PixelType,
00089 typename TOutputImage::PixelType>));
00090
00092 #endif
00093
00094 protected:
00095 SubtractImageFilter() {}
00096 virtual ~SubtractImageFilter() {}
00097
00098 private:
00099 SubtractImageFilter(const Self&);
00100 void operator=(const Self&);
00101
00102
00103 };
00104
00105 }
00106
00107
00108 #endif
00109