00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkGradientToMagnitudeImageFilter_h
00018 #define __itkGradientToMagnitudeImageFilter_h
00019
00020 #include "itkUnaryFunctorImageFilter.h"
00021
00022 namespace itk
00023 {
00024
00039 namespace Functor {
00040
00041 template< class TInput, class TOutput>
00042 class GradientMagnitude
00043 {
00044 public:
00045 GradientMagnitude() {}
00046 ~GradientMagnitude() {}
00047
00048 bool operator!=( const GradientMagnitude & ) const
00049 {
00050 return false;
00051 }
00052 bool operator==( const GradientMagnitude & other ) const
00053 {
00054 return !(*this != other);
00055 }
00056 inline TOutput operator()( const TInput & A ) const
00057 {
00058 return static_cast<TOutput>( A.GetNorm() );
00059 }
00060 };
00061 }
00062
00063 template <class TInputImage, class TOutputImage>
00064 class ITK_EXPORT GradientToMagnitudeImageFilter :
00065 public
00066 UnaryFunctorImageFilter<TInputImage,TOutputImage,
00067 Functor::GradientMagnitude< typename TInputImage::PixelType,
00068 typename TOutputImage::PixelType> >
00069 {
00070 public:
00072 typedef GradientToMagnitudeImageFilter Self;
00073 typedef UnaryFunctorImageFilter<
00074 TInputImage,TOutputImage,
00075 Functor::GradientMagnitude< typename TInputImage::PixelType,
00076 typename TOutputImage::PixelType> >
00077 Superclass;
00078 typedef SmartPointer<Self> Pointer;
00079 typedef SmartPointer<const Self> ConstPointer;
00080
00082 itkNewMacro(Self);
00083
00085 itkTypeMacro(GradientToMagnitudeImageFilter,
00086 UnaryFunctorImageFilter);
00087
00088 #ifdef ITK_USE_CONCEPT_CHECKING
00089
00090 itkConceptMacro(InputHasNumericTraitsCheck,
00091 (Concept::HasNumericTraits<typename TInputImage::PixelType::ValueType>));
00092
00094 #endif
00095
00096 protected:
00097 GradientToMagnitudeImageFilter() {}
00098 virtual ~GradientToMagnitudeImageFilter() {}
00099
00100 private:
00101 GradientToMagnitudeImageFilter(const Self&);
00102 void operator=(const Self&);
00103 };
00104
00105 }
00106
00107
00108 #endif
00109