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-10-29 11:19:16 $
00007   Version:   $Revision: 1.9 $
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::IndexValueType       IndexValueType;
00075   typedef typename Superclass::ContinuousIndexType  ContinuousIndexType;
00076   typedef typename Superclass::PointType            PointType;
00077 
00079   itkStaticConstMacro(ImageDimension2, unsigned int,
00080                       InputImageType::ImageDimension);
00081 
00083   typedef typename Superclass::OutputType     OutputType;
00084 
00086   typedef FixedArray<double,itkGetStaticConstMacro(ImageDimension2)>        VarianceArrayType;
00087   typedef FixedArray<unsigned int,itkGetStaticConstMacro(ImageDimension2)>  OrderArrayType;
00089 
00090   typedef itk::GaussianDerivativeOperator<TOutput,
00091     itkGetStaticConstMacro(ImageDimension2)>    GaussianDerivativeOperatorType;
00092 
00094   typedef FixedArray<GaussianDerivativeOperatorType,
00095     2*itkGetStaticConstMacro(ImageDimension2)>            GaussianDerivativeOperatorArrayType;
00096 
00098   typedef Neighborhood<TOutput,itkGetStaticConstMacro(ImageDimension2)>  KernelType;
00099 
00101   typedef FixedArray<KernelType,itkGetStaticConstMacro(ImageDimension2)>      KernelArrayType;
00102 
00104   typedef NeighborhoodOperatorImageFunction
00105     <InputImageType, TOutput>                           OperatorImageFunctionType;
00106   typedef typename OperatorImageFunctionType::Pointer   OperatorImageFunctionPointer;
00107 
00109   enum InterpolationModeType { NearestNeighbourInterpolation, LinearInterpolation };
00110 
00111 public:
00112 
00114   virtual OutputType Evaluate(const PointType& point) const;
00115 
00117   virtual OutputType EvaluateAtIndex( const IndexType & index ) const;
00118 
00120   virtual OutputType EvaluateAtContinuousIndex(
00121     const ContinuousIndexType & index ) const;
00122 
00127   itkSetMacro(Variance, VarianceArrayType);
00128   itkGetConstMacro(Variance, const VarianceArrayType);
00129   itkSetVectorMacro( Variance, double, VarianceArrayType::Length );
00131 
00133   virtual void SetVariance( double variance )
00134     {
00135     m_Variance.Fill( variance );
00136     this->Modified();
00137     }
00139 
00141   void SetSigma( const double sigma )
00142     {
00143     SetVariance( sigma * sigma );
00144     }
00145 
00151   itkSetClampMacro( MaximumError, double, 0.00001, 0.99999 );
00152   itkGetConstMacro( MaximumError, double );
00154 
00158   itkSetMacro( NormalizeAcrossScale, bool );
00159   itkGetConstMacro( NormalizeAcrossScale, bool );
00160   itkBooleanMacro( NormalizeAcrossScale );
00162 
00164   itkSetMacro( UseImageSpacing, bool );
00165   itkGetConstMacro( UseImageSpacing, bool );
00166   itkBooleanMacro( UseImageSpacing );
00168 
00173   itkSetMacro( MaximumKernelWidth, unsigned int );
00174   itkGetConstMacro( MaximumKernelWidth, unsigned int );
00176 
00178   itkSetMacro( InterpolationMode, InterpolationModeType );
00179   itkGetConstMacro( InterpolationMode, InterpolationModeType );
00181 
00186   virtual void SetInputImage( const InputImageType * ptr );
00187 
00190   virtual void Initialize( ) { RecomputeGaussianKernel(); }
00191 
00192 protected:
00193 
00194   DiscreteGradientMagnitudeGaussianImageFunction();
00195   DiscreteGradientMagnitudeGaussianImageFunction( const Self& ){};
00196 
00197   ~DiscreteGradientMagnitudeGaussianImageFunction(){};
00198 
00199   void operator=( const Self& ){};
00200   void PrintSelf(std::ostream& os, Indent indent) const;
00201 
00202   void RecomputeGaussianKernel();
00203  // void RecomputeContinuousGaussianKernel(
00204    //        const double* offset) const;
00205 
00206 private:
00207 
00209   VarianceArrayType m_Variance;
00210 
00213   double m_MaximumError;
00214 
00218   unsigned int m_MaximumKernelWidth;
00219 
00223   GaussianDerivativeOperatorArrayType   m_OperatorArray;
00224 
00226   KernelArrayType  m_KernelArray;
00227 
00229   OperatorImageFunctionPointer  m_OperatorImageFunction;
00230 
00232   bool m_NormalizeAcrossScale;
00233 
00235   bool m_UseImageSpacing;
00236 
00238   InterpolationModeType  m_InterpolationMode;
00239 
00240 };
00241 
00242 } // namespace itk
00243 
00244 // Define instantiation macro for this template.
00245 #define ITK_TEMPLATE_DiscreteGradientMagnitudeGaussianImageFunction(_, EXPORT, x, y) namespace itk { \
00246   _(2(class EXPORT DiscreteGradientMagnitudeGaussianImageFunction< ITK_TEMPLATE_2 x >)) \
00247   namespace Templates { typedef DiscreteGradientMagnitudeGaussianImageFunction< ITK_TEMPLATE_2 x > \
00248                         DiscreteGradientMagnitudeGaussianImageFunction##y; } \
00249   }
00250 
00251 #if ITK_TEMPLATE_EXPLICIT
00252 # include "Templates/itkDiscreteGradientMagnitudeGaussianImageFunction+-.h"
00253 #endif
00254 
00255 #if ITK_TEMPLATE_TXX
00256 # include "itkDiscreteGradientMagnitudeGaussianImageFunction.txx"
00257 #endif
00258 
00259 #endif
00260 

Generated at Mon Jul 12 2010 18:14:23 for ITK by doxygen 1.7.1 written by Dimitri van Heesch, © 1997-2000