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) const
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<
00070 TInputImage1,TInputImage2,TOutputImage,
00071 Function::Sub2< typename TInputImage1::PixelType,
00072 typename TInputImage2::PixelType,
00073 typename TOutputImage::PixelType> > Superclass;
00074 typedef SmartPointer<Self> Pointer;
00075 typedef SmartPointer<const Self> ConstPointer;
00076
00077
00079 itkNewMacro(Self);
00080
00082 itkTypeMacro(SubtractImageFilter,
00083 BinaryFunctorImageFilter);
00084
00085 #ifdef ITK_USE_CONCEPT_CHECKING
00086
00087 itkConceptMacro(Input1Input2OutputAdditiveOperatorsCheck,
00088 (Concept::AdditiveOperators<typename TInputImage1::PixelType,
00089 typename TInputImage2::PixelType,
00090 typename TOutputImage::PixelType>));
00091
00093 #endif
00094
00095 protected:
00096 SubtractImageFilter() {}
00097 virtual ~SubtractImageFilter() {}
00098
00099 private:
00100 SubtractImageFilter(const Self&);
00101 void operator=(const Self&);
00102
00103
00104 };
00105
00106 }
00107
00108
00109 #endif
00110