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 )
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<TInputImage,TOutputImage,
00074 Functor::GradientMagnitude< typename TInputImage::PixelType,
00075 typename TOutputImage::PixelType> > Superclass;
00076 typedef SmartPointer<Self> Pointer;
00077 typedef SmartPointer<const Self> ConstPointer;
00078
00080 itkNewMacro(Self);
00081
00083 itkTypeMacro(GradientToMagnitudeImageFilter,
00084 UnaryFunctorImageFilter);
00085
00086 #ifdef ITK_USE_CONCEPT_CHECKING
00087
00088 itkConceptMacro(InputHasNumericTraitsCheck,
00089 (Concept::HasNumericTraits<typename TInputImage::PixelType::ValueType>));
00090
00092 #endif
00093
00094 protected:
00095 GradientToMagnitudeImageFilter() {}
00096 virtual ~GradientToMagnitudeImageFilter() {}
00097
00098 private:
00099 GradientToMagnitudeImageFilter(const Self&);
00100 void operator=(const Self&);
00101 };
00102
00103 }
00104
00105
00106 #endif
00107