00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkBoundedReciprocalImageFilter_h
00018 #define __itkBoundedReciprocalImageFilter_h
00019
00020 #include "itkUnaryFunctorImageFilter.h"
00021
00022 namespace itk
00023 {
00024
00033 namespace Functor {
00034
00035 template< class TInput, class TOutput>
00036 class BoundedReciprocal
00037 {
00038 public:
00039 BoundedReciprocal() {};
00040 ~BoundedReciprocal() {};
00041 bool operator!=( const BoundedReciprocal & ) const
00042 {
00043 return false;
00044 }
00045 bool operator==( const BoundedReciprocal & other ) const
00046 {
00047 return !(*this != other);
00048 }
00049 inline TOutput operator()( const TInput & A )
00050 {
00051 return static_cast<TOutput>( 1.0 / ( 1.0 + static_cast<double>(A) ) );
00052 }
00053 };
00054 }
00055
00056 template <class TInputImage, class TOutputImage>
00057 class ITK_EXPORT BoundedReciprocalImageFilter :
00058 public
00059 UnaryFunctorImageFilter<TInputImage,TOutputImage,
00060 Functor::BoundedReciprocal<
00061 typename TInputImage::PixelType,
00062 typename TOutputImage::PixelType> >
00063 {
00064 public:
00066 typedef BoundedReciprocalImageFilter Self;
00067 typedef UnaryFunctorImageFilter<TInputImage,TOutputImage,
00068 Functor::BoundedReciprocal<
00069 typename TInputImage::PixelType,
00070 typename TOutputImage::PixelType>
00071 > Superclass;
00072 typedef SmartPointer<Self> Pointer;
00073 typedef SmartPointer<const Self> ConstPointer;
00074
00076 itkNewMacro(Self);
00077
00078 #ifdef ITK_USE_CONCEPT_CHECKING
00079
00080 itkConceptMacro(InputConvertibleToDoubleCheck,
00081 (Concept::Convertible<typename TInputImage::PixelType, double>));
00082 itkConceptMacro(DoubleConvertibleToOutputCheck,
00083 (Concept::Convertible<double, typename TOutputImage::PixelType>));
00084
00086 #endif
00087
00088 protected:
00089 BoundedReciprocalImageFilter() {}
00090 virtual ~BoundedReciprocalImageFilter() {}
00091
00092 private:
00093 BoundedReciprocalImageFilter(const Self&);
00094 void operator=(const Self&);
00095
00096 };
00097
00098
00099 }
00100
00101
00102 #endif
00103