00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkDivideImageFilter_h
00018 #define __itkDivideImageFilter_h
00019
00020 #include "itkBinaryFunctorImageFilter.h"
00021 #include "itkNumericTraits.h"
00022
00023 namespace itk
00024 {
00025
00037 namespace Function {
00038
00039 template< class TInput1, class TInput2, class TOutput>
00040 class Div
00041 {
00042 public:
00043 Div() {};
00044 ~Div() {};
00045 bool operator!=( const Div & ) const
00046 {
00047 return false;
00048 }
00049 bool operator==( const Div & other ) const
00050 {
00051 return !(*this != other);
00052 }
00053 inline TOutput operator()( const TInput1 & A, const TInput2 & B)
00054 {
00055 if(B != (TInput2) 0)
00056 return (TOutput)(A / B);
00057 else
00058 return NumericTraits<TOutput>::max();
00059 }
00060 };
00061 }
00062
00063 template <class TInputImage1, class TInputImage2, class TOutputImage>
00064 class ITK_EXPORT DivideImageFilter :
00065 public
00066 BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage,
00067 Function::Div<
00068 typename TInputImage1::PixelType,
00069 typename TInputImage2::PixelType,
00070 typename TOutputImage::PixelType> >
00071 {
00072 public:
00076 typedef DivideImageFilter Self;
00077
00081 typedef BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage,
00082 Function::Div<
00083 typename TInputImage1::PixelType,
00084 typename TInputImage2::PixelType,
00085 typename TOutputImage::PixelType>
00086 > Superclass;
00087
00091 typedef SmartPointer<Self> Pointer;
00092 typedef SmartPointer<const Self> ConstPointer;
00093
00097 itkNewMacro(Self);
00098
00099 #ifdef ITK_USE_CONCEPT_CHECKING
00100
00101 itkConceptMacro(IntConvertibleToInput2Check,
00102 (Concept::Convertible<int, typename TInputImage2::PixelType>));
00103 itkConceptMacro(Input1Input2OutputDivisionOperatorsCheck,
00104 (Concept::DivisionOperators<typename TInputImage1::PixelType,
00105 typename TInputImage2::PixelType,
00106 typename TOutputImage::PixelType>));
00107
00109 #endif
00110
00111 protected:
00112 DivideImageFilter() {}
00113 virtual ~DivideImageFilter() {}
00114 DivideImageFilter(const Self&) {}
00115 void operator=(const Self&) {}
00116
00117 };
00118
00119 }
00120
00121
00122 #endif
00123