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: 2008-10-26 14:58:32 $
00007   Version:   $Revision: 1.4 $
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   itkGetMacro(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 
00149   itkSetClampMacro( MaximumError, double, 0.00001, 0.99999 );
00150   itkGetMacro( MaximumError, double );
00152 
00155   itkSetMacro( NormalizeAcrossScale, bool );
00156   itkGetMacro( NormalizeAcrossScale, bool );
00157   itkBooleanMacro( NormalizeAcrossScale );
00159 
00161   itkSetMacro( UseImageSpacing, bool );
00162   itkGetMacro( UseImageSpacing, bool );
00163   itkBooleanMacro( UseImageSpacing );
00165 
00170   itkSetMacro( MaximumKernelWidth, unsigned int );
00171   itkGetMacro( MaximumKernelWidth, unsigned int );
00173 
00175   itkSetMacro( InterpolationMode, InterpolationModeType );
00176   itkGetMacro( InterpolationMode, InterpolationModeType );
00178 
00183   virtual void SetInputImage( const InputImageType * ptr );
00184 
00187   virtual void Initialize( ) { RecomputeGaussianKernel(); }
00188 
00189 protected:
00190 
00191   DiscreteGradientMagnitudeGaussianImageFunction();
00192   DiscreteGradientMagnitudeGaussianImageFunction( const Self& ){};
00193 
00194   ~DiscreteGradientMagnitudeGaussianImageFunction(){};
00195 
00196   void operator=( const Self& ){};
00197   void PrintSelf(std::ostream& os, Indent indent) const;
00198 
00199   void RecomputeGaussianKernel();
00200  // void RecomputeContinuousGaussianKernel(
00201    //        const double* offset) const;
00202 
00203 private:
00204 
00206   VarianceArrayType m_Variance;
00207 
00210   double m_MaximumError;
00211 
00215   unsigned int m_MaximumKernelWidth;
00216 
00220   GaussianDerivativeOperatorArrayType   m_OperatorArray;
00221 
00223   KernelArrayType  m_KernelArray;
00224 
00226   OperatorImageFunctionPointer  m_OperatorImageFunction;
00227 
00229   bool m_NormalizeAcrossScale;
00230 
00232   bool m_UseImageSpacing;
00233 
00235   InterpolationModeType  m_InterpolationMode;
00236 
00237 };
00238 
00239 } // namespace itk
00240 
00241 // Define instantiation macro for this template.
00242 #define ITK_TEMPLATE_DiscreteGradientMagnitudeGaussianImageFunction(_, EXPORT, x, y) namespace itk { \
00243   _(2(class EXPORT DiscreteGradientMagnitudeGaussianImageFunction< ITK_TEMPLATE_2 x >)) \
00244   namespace Templates { typedef DiscreteGradientMagnitudeGaussianImageFunction< ITK_TEMPLATE_2 x > \
00245                         DiscreteGradientMagnitudeGaussianImageFunction##y; } \
00246   }
00247 
00248 #if ITK_TEMPLATE_EXPLICIT
00249 # include "Templates/itkDiscreteGradientMagnitudeGaussianImageFunction+-.h"
00250 #endif
00251 
00252 #if ITK_TEMPLATE_TXX
00253 # include "itkDiscreteGradientMagnitudeGaussianImageFunction.txx"
00254 #endif
00255 
00256 #endif
00257 

Generated at Wed Nov 5 21:10:14 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000