Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkDiscreteGradientMagnitudeGaussianImageFunction.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkDiscreteGradientMagnitudeGaussianImageFunction.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-04-23 03:43:41 $
00007   Version:   $Revision: 1.8 $
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 
00018 #ifndef __itkDiscreteGradientMagnitudeGaussianImageFunction_h
00019 #define __itkDiscreteGradientMagnitudeGaussianImageFunction_h
00020 
00021 #include "itkNeighborhoodOperatorImageFunction.h"
00022 #include "itkImageFunction.h"
00023 #include "itkGaussianOperator.h"
00024 #include "itkGaussianDerivativeOperator.h"
00025 
00026 namespace itk
00027 {
00028 
00048 template <class TInputImage,class TOutput=double>
00049 class ITK_EXPORT DiscreteGradientMagnitudeGaussianImageFunction :
00050   public ImageFunction< TInputImage, TOutput, TOutput >
00051 {
00052 public:
00053 
00055   typedef DiscreteGradientMagnitudeGaussianImageFunction   Self;
00056 
00058   typedef ImageFunction<TInputImage, TOutput, TOutput>  Superclass;
00059 
00061   typedef SmartPointer<Self>        Pointer;
00062   typedef SmartPointer<const Self>  ConstPointer;
00063 
00065   itkNewMacro(Self);
00066 
00068   itkTypeMacro( DiscreteGradientMagnitudeGaussianImageFunction, ImageFunction );
00069 
00071   typedef typename Superclass::InputImageType       InputImageType;
00072   typedef typename Superclass::InputPixelType       InputPixelType;
00073   typedef typename Superclass::IndexType            IndexType;
00074   typedef typename Superclass::ContinuousIndexType  ContinuousIndexType;
00075   typedef typename Superclass::PointType            PointType;
00076 
00078   itkStaticConstMacro(ImageDimension2, unsigned int,
00079                       InputImageType::ImageDimension);
00080 
00082   typedef typename Superclass::OutputType     OutputType;
00083 
00085   typedef FixedArray<double,itkGetStaticConstMacro(ImageDimension2)>        VarianceArrayType;
00086   typedef FixedArray<unsigned int,itkGetStaticConstMacro(ImageDimension2)>  OrderArrayType;
00088 
00089   typedef itk::GaussianDerivativeOperator<TOutput,
00090     itkGetStaticConstMacro(ImageDimension2)>    GaussianDerivativeOperatorType;
00091 
00093   typedef FixedArray<GaussianDerivativeOperatorType,
00094     2*itkGetStaticConstMacro(ImageDimension2)>            GaussianDerivativeOperatorArrayType;
00095 
00097   typedef Neighborhood<TOutput,itkGetStaticConstMacro(ImageDimension2)>  KernelType;
00098 
00100   typedef FixedArray<KernelType,itkGetStaticConstMacro(ImageDimension2)>      KernelArrayType;
00101 
00103   typedef NeighborhoodOperatorImageFunction
00104     <InputImageType, TOutput>                           OperatorImageFunctionType;
00105   typedef typename OperatorImageFunctionType::Pointer   OperatorImageFunctionPointer;
00106 
00108   enum InterpolationModeType { NearestNeighbourInterpolation, LinearInterpolation };
00109 
00110 public:
00111 
00113   virtual OutputType Evaluate(const PointType& point) const;
00114 
00116   virtual OutputType EvaluateAtIndex( const IndexType & index ) const;
00117 
00119   virtual OutputType EvaluateAtContinuousIndex(
00120     const ContinuousIndexType & index ) const;
00121 
00126   itkSetMacro(Variance, VarianceArrayType);
00127   itkGetConstMacro(Variance, const VarianceArrayType);
00128   itkSetVectorMacro( Variance, double, VarianceArrayType::Length );
00130 
00132   virtual void SetVariance( double variance )
00133     {
00134     m_Variance.Fill( variance );
00135     this->Modified();
00136     }
00138 
00140   void SetSigma( const double sigma )
00141     {
00142     SetVariance( sigma * sigma );
00143     }
00144 
00150   itkSetClampMacro( MaximumError, double, 0.00001, 0.99999 );
00151   itkGetConstMacro( MaximumError, double );
00153 
00157   itkSetMacro( NormalizeAcrossScale, bool );
00158   itkGetConstMacro( NormalizeAcrossScale, bool );
00159   itkBooleanMacro( NormalizeAcrossScale );
00161 
00163   itkSetMacro( UseImageSpacing, bool );
00164   itkGetConstMacro( UseImageSpacing, bool );
00165   itkBooleanMacro( UseImageSpacing );
00167 
00172   itkSetMacro( MaximumKernelWidth, unsigned int );
00173   itkGetConstMacro( MaximumKernelWidth, unsigned int );
00175 
00177   itkSetMacro( InterpolationMode, InterpolationModeType );
00178   itkGetConstMacro( InterpolationMode, InterpolationModeType );
00180 
00185   virtual void SetInputImage( const InputImageType * ptr );
00186 
00189   virtual void Initialize( ) { RecomputeGaussianKernel(); }
00190 
00191 protected:
00192 
00193   DiscreteGradientMagnitudeGaussianImageFunction();
00194   DiscreteGradientMagnitudeGaussianImageFunction( const Self& ){};
00195 
00196   ~DiscreteGradientMagnitudeGaussianImageFunction(){};
00197 
00198   void operator=( const Self& ){};
00199   void PrintSelf(std::ostream& os, Indent indent) const;
00200 
00201   void RecomputeGaussianKernel();
00202  // void RecomputeContinuousGaussianKernel(
00203    //        const double* offset) const;
00204 
00205 private:
00206 
00208   VarianceArrayType m_Variance;
00209 
00212   double m_MaximumError;
00213 
00217   unsigned int m_MaximumKernelWidth;
00218 
00222   GaussianDerivativeOperatorArrayType   m_OperatorArray;
00223 
00225   KernelArrayType  m_KernelArray;
00226 
00228   OperatorImageFunctionPointer  m_OperatorImageFunction;
00229 
00231   bool m_NormalizeAcrossScale;
00232 
00234   bool m_UseImageSpacing;
00235 
00237   InterpolationModeType  m_InterpolationMode;
00238 
00239 };
00240 
00241 } // namespace itk
00242 
00243 // Define instantiation macro for this template.
00244 #define ITK_TEMPLATE_DiscreteGradientMagnitudeGaussianImageFunction(_, EXPORT, x, y) namespace itk { \
00245   _(2(class EXPORT DiscreteGradientMagnitudeGaussianImageFunction< ITK_TEMPLATE_2 x >)) \
00246   namespace Templates { typedef DiscreteGradientMagnitudeGaussianImageFunction< ITK_TEMPLATE_2 x > \
00247                         DiscreteGradientMagnitudeGaussianImageFunction##y; } \
00248   }
00249 
00250 #if ITK_TEMPLATE_EXPLICIT
00251 # include "Templates/itkDiscreteGradientMagnitudeGaussianImageFunction+-.h"
00252 #endif
00253 
00254 #if ITK_TEMPLATE_TXX
00255 # include "itkDiscreteGradientMagnitudeGaussianImageFunction.txx"
00256 #endif
00257 
00258 #endif
00259 

Generated at Thu May 28 09:49:36 2009 for ITK by doxygen 1.5.5 written by Dimitri van Heesch, © 1997-2000