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

itkDiscreteGaussianDerivativeImageFunction.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkDiscreteGaussianDerivativeImageFunction.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-04-23 03:43:41 $
00007   Version:   $Revision: 1.10 $
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 __itkDiscreteGaussianDerivativeImageFunction_h
00019 #define __itkDiscreteGaussianDerivativeImageFunction_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 DiscreteGaussianDerivativeImageFunction :
00050   public ImageFunction< TInputImage, TOutput, TOutput >
00051 {
00052 public:
00053 
00055   typedef DiscreteGaussianDerivativeImageFunction   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( DiscreteGaussianDerivativeImageFunction, 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     itkGetStaticConstMacro(ImageDimension2)>            GaussianDerivativeOperatorArrayType;
00095 
00097   typedef Neighborhood<TOutput,itkGetStaticConstMacro(ImageDimension2)>  KernelType;
00098 
00100   typedef NeighborhoodOperatorImageFunction
00101     <InputImageType, TOutput>                           OperatorImageFunctionType;
00102   typedef typename OperatorImageFunctionType::Pointer   OperatorImageFunctionPointer;
00103 
00105   enum InterpolationModeType { NearestNeighbourInterpolation, LinearInterpolation };
00106 
00107 public:
00108 
00110   virtual OutputType Evaluate(const PointType& point) const;
00111 
00113   virtual OutputType EvaluateAtIndex( const IndexType & index ) const;
00114 
00116   virtual OutputType EvaluateAtContinuousIndex(
00117     const ContinuousIndexType & index ) const;
00118 
00125   itkSetMacro( Variance, VarianceArrayType );
00126   itkGetConstMacro( Variance, const VarianceArrayType );
00127   itkSetVectorMacro( Variance, double, VarianceArrayType::Length );
00129 
00131   virtual void SetVariance( double variance )
00132     {
00133     m_Variance.Fill( variance );
00134     this->Modified();
00135     }
00137 
00141   void SetSigma( const double sigma )
00142     {
00143     SetVariance( sigma * sigma );
00144     }
00145 
00152   itkSetClampMacro( MaximumError, double, 0.00001, 0.99999 );
00153   itkGetConstMacro( MaximumError, double );
00155 
00157   itkSetMacro( Order, OrderArrayType );
00158   itkGetConstMacro( Order, const OrderArrayType );
00159   itkSetVectorMacro( Order, unsigned int, OrderArrayType::Length );
00161 
00163   virtual void SetOrder( unsigned int order )
00164     {
00165     m_Order.Fill( order );
00166     this->Modified();
00167     }
00169 
00173   itkSetMacro( NormalizeAcrossScale, bool );
00174   itkGetConstMacro( NormalizeAcrossScale, bool );
00175   itkBooleanMacro( NormalizeAcrossScale );
00177 
00179   itkSetMacro( UseImageSpacing, bool );
00180   itkGetConstMacro( UseImageSpacing, bool );
00181   itkBooleanMacro( UseImageSpacing );
00183 
00188   itkSetMacro( MaximumKernelWidth, unsigned int );
00189   itkGetConstMacro( MaximumKernelWidth, unsigned int );
00191 
00193   itkSetMacro( InterpolationMode, InterpolationModeType );
00194   itkGetConstMacro( InterpolationMode, InterpolationModeType );
00196 
00201   virtual void SetInputImage( const InputImageType * ptr );
00202 
00206   virtual void Initialize( ) { RecomputeGaussianKernel(); }
00207 
00208 protected:
00209 
00210   DiscreteGaussianDerivativeImageFunction();
00211   DiscreteGaussianDerivativeImageFunction( const Self& ){};
00212 
00213   ~DiscreteGaussianDerivativeImageFunction(){};
00214 
00215   void operator=( const Self& ){};
00216   void PrintSelf(std::ostream& os, Indent indent) const;
00217 
00218   void RecomputeGaussianKernel();
00219 
00220 private:
00221 
00223   VarianceArrayType m_Variance;
00224 
00226   OrderArrayType m_Order;
00227 
00230   double m_MaximumError;
00231 
00235   unsigned int m_MaximumKernelWidth;
00236 
00238   GaussianDerivativeOperatorArrayType m_OperatorArray;
00239 
00242   KernelType m_DerivativeKernel;
00243 
00245   OperatorImageFunctionPointer m_OperatorImageFunction;
00246 
00248   bool m_NormalizeAcrossScale;
00249 
00251   bool m_UseImageSpacing;
00252 
00254   InterpolationModeType m_InterpolationMode;
00255 
00256 };
00257 
00258 } // namespace itk
00259 
00260 // Define instantiation macro for this template.
00261 #define ITK_TEMPLATE_DiscreteGaussianDerivativeImageFunction(_, EXPORT, x, y) namespace itk { \
00262   _(2(class EXPORT DiscreteGaussianDerivativeImageFunction< ITK_TEMPLATE_2 x >)) \
00263   namespace Templates { typedef DiscreteGaussianDerivativeImageFunction< ITK_TEMPLATE_2 x > \
00264                          DiscreteGaussianDerivativeImageFunction##y; } \
00265   }
00266 
00267 #if ITK_TEMPLATE_EXPLICIT
00268 # include "Templates/itkDiscreteGaussianDerivativeImageFunction+-.h"
00269 #endif
00270 
00271 #if ITK_TEMPLATE_TXX
00272 # include "itkDiscreteGaussianDerivativeImageFunction.txx"
00273 #endif
00274 
00275 #endif
00276 

Generated at Tue Sep 15 02:48:46 2009 for ITK by doxygen 1.5.8 written by Dimitri van Heesch, © 1997-2000