Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkComplexToModulusImageFilter_h
00018 #define __itkComplexToModulusImageFilter_h
00019
00020 #include "itkUnaryFunctorImageFilter.h"
00021 #include "vnl/vnl_math.h"
00022
00023 namespace itk
00024 {
00025
00031 namespace Function {
00032
00033 template< class TInput, class TOutput>
00034 class ComplexToModulus
00035 {
00036 public:
00037 ComplexToModulus() {}
00038 ~ComplexToModulus() {}
00039 bool operator!=( const ComplexToModulus & ) const
00040 {
00041 return false;
00042 }
00043 bool operator==( const ComplexToModulus & other ) const
00044 {
00045 return !(*this != other);
00046 }
00047 inline TOutput operator()( const TInput & A ) const
00048 {
00049 return (TOutput)( vcl_sqrt(A.real() * A.real() +
00050 A.imag() * A.imag() ) );
00051 }
00052 };
00053 }
00054
00055 template <class TInputImage, class TOutputImage>
00056 class ITK_EXPORT ComplexToModulusImageFilter :
00057 public
00058 UnaryFunctorImageFilter<TInputImage,TOutputImage,
00059 Function::ComplexToModulus<
00060 typename TInputImage::PixelType,
00061 typename TOutputImage::PixelType> >
00062 {
00063 public:
00065 typedef ComplexToModulusImageFilter Self;
00066 typedef UnaryFunctorImageFilter<
00067 TInputImage,TOutputImage,
00068 Function::ComplexToModulus< typename TInputImage::PixelType,
00069 typename TOutputImage::PixelType> >
00070 Superclass;
00071 typedef SmartPointer<Self> Pointer;
00072 typedef SmartPointer<const Self> ConstPointer;
00073
00075 itkNewMacro(Self);
00076
00078 itkTypeMacro(ComplexToModulusImageFilter,
00079 UnaryFunctorImageFilter);
00080
00081 typedef typename TInputImage::PixelType InputPixelType;
00082 typedef typename TOutputImage::PixelType OutputPixelType;
00083 typedef typename NumericTraits< InputPixelType >::ValueType InputPixelValueType;
00084
00085
00086 #ifdef ITK_USE_CONCEPT_CHECKING
00087
00088 itkConceptMacro(InputMultiplyOperatorCheck,
00089 (Concept::MultiplyOperator<InputPixelValueType>));
00090
00092 #endif
00093
00094 protected:
00095 ComplexToModulusImageFilter() {}
00096 virtual ~ComplexToModulusImageFilter() {}
00097
00098 private:
00099 ComplexToModulusImageFilter(const Self&);
00100 void operator=(const Self&);
00101
00102 };
00103
00104 }
00105
00106
00107 #endif
00108