00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkGradientToMagnitudeImageFilter.h,v $ 00005 Language: C++ 00006 Date: $Date: 2002/09/26 16:35:56 $ 00007 Version: $Revision: 1.14 $ 00008 00009 Copyright (c) 2002 Insight 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 inline TOutput operator()( const TInput & A ) 00049 { 00050 return static_cast<TOutput>( A.GetNorm() ); 00051 } 00052 }; 00053 } 00054 00055 template <class TInputImage, class TOutputImage> 00056 class ITK_EXPORT GradientToMagnitudeImageFilter : 00057 public 00058 UnaryFunctorImageFilter<TInputImage,TOutputImage, 00059 Functor::GradientMagnitude< typename TInputImage::PixelType, 00060 typename TOutputImage::PixelType> > 00061 { 00062 public: 00064 typedef GradientToMagnitudeImageFilter Self; 00065 typedef UnaryFunctorImageFilter<TInputImage,TOutputImage, 00066 Functor::GradientMagnitude< typename TInputImage::PixelType, 00067 typename TOutputImage::PixelType> > Superclass; 00068 typedef SmartPointer<Self> Pointer; 00069 typedef SmartPointer<const Self> ConstPointer; 00070 00072 itkNewMacro(Self); 00073 00074 protected: 00075 GradientToMagnitudeImageFilter() {} 00076 virtual ~GradientToMagnitudeImageFilter() {} 00077 00078 private: 00079 GradientToMagnitudeImageFilter(const Self&); //purposely not implemented 00080 void operator=(const Self&); //purposely not implemented 00081 }; 00082 00083 } // end namespace itk 00084 00085 00086 #endif