Go to the documentation of this file.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) const
00054 {
00055 if(B != (TInput2) 0)
00056 {
00057 return (TOutput)(A / B);
00058 }
00059 else
00060 {
00061 return NumericTraits<TOutput>::max(A);
00062 }
00063 }
00064 };
00065 }
00066
00067 template <class TInputImage1, class TInputImage2, class TOutputImage>
00068 class ITK_EXPORT DivideImageFilter :
00069 public
00070 BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage,
00071 Function::Div<
00072 typename TInputImage1::PixelType,
00073 typename TInputImage2::PixelType,
00074 typename TOutputImage::PixelType> >
00075 {
00076 public:
00080 typedef DivideImageFilter Self;
00081
00085 typedef BinaryFunctorImageFilter<TInputImage1,TInputImage2,TOutputImage,
00086 Function::Div<
00087 typename TInputImage1::PixelType,
00088 typename TInputImage2::PixelType,
00089 typename TOutputImage::PixelType>
00090 > Superclass;
00091
00095 typedef SmartPointer<Self> Pointer;
00096 typedef SmartPointer<const Self> ConstPointer;
00097
00101 itkNewMacro(Self);
00102
00104 itkTypeMacro(DivideImageFilter,
00105 BinaryFunctorImageFilter);
00106
00107 #ifdef ITK_USE_CONCEPT_CHECKING
00108
00109 itkConceptMacro(IntConvertibleToInput2Check,
00110 (Concept::Convertible<int, typename TInputImage2::PixelType>));
00111 itkConceptMacro(Input1Input2OutputDivisionOperatorsCheck,
00112 (Concept::DivisionOperators<typename TInputImage1::PixelType,
00113 typename TInputImage2::PixelType,
00114 typename TOutputImage::PixelType>));
00115
00117 #endif
00118
00119 protected:
00120 DivideImageFilter() {}
00121 virtual ~DivideImageFilter() {}
00122 DivideImageFilter(const Self&) {}
00123 void operator=(const Self&) {}
00124
00125 };
00126
00127 }
00128
00129
00130 #endif
00131