00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkGradientToMagnitudeImageFilter.h,v $ 00005 Language: C++ 00006 Date: $Date: 2006/03/28 19:59:04 $ 00007 Version: $Revision: 1.20 $ 00008 00009 Copyright (c) Insight Software Consortium. All rights reserved. 00010 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 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 00082 #ifdef ITK_USE_CONCEPT_CHECKING 00083 00084 itkConceptMacro(InputHasNumericTraitsCheck, 00085 (Concept::HasNumericTraits<typename TInputImage::PixelType::ValueType>)); 00086 00088 #endif 00089 00090 protected: 00091 GradientToMagnitudeImageFilter() {} 00092 virtual ~GradientToMagnitudeImageFilter() {} 00093 00094 private: 00095 GradientToMagnitudeImageFilter(const Self&); //purposely not implemented 00096 void operator=(const Self&); //purposely not implemented 00097 }; 00098 00099 } // end namespace itk 00100 00101 00102 #endif 00103