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

itkDiscreteHessianGaussianImageFunction.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkDiscreteHessianGaussianImageFunction.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-10-29 11:19:17 $
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 __itkDiscreteHessianGaussianImageFunction_h
00019 #define __itkDiscreteHessianGaussianImageFunction_h
00020 
00021 #include "itkNeighborhoodOperatorImageFunction.h"
00022 #include "itkImageFunction.h"
00023 #include "itkGaussianOperator.h"
00024 #include "itkGaussianDerivativeOperator.h"
00025 #include "itkSymmetricSecondRankTensor.h"
00026 
00027 namespace itk
00028 {
00029 
00047 template <class TInputImage,class TOutput=double>
00048 class ITK_EXPORT DiscreteHessianGaussianImageFunction :
00049   public ImageFunction< TInputImage,
00050     SymmetricSecondRankTensor<TOutput,::itk::GetImageDimension<TInputImage>::ImageDimension>,
00051     TOutput >
00052 {
00053 public:
00054 
00056   typedef DiscreteHessianGaussianImageFunction   Self;
00057 
00059   typedef ImageFunction<TInputImage,
00060     SymmetricSecondRankTensor<TOutput,::itk::GetImageDimension<TInputImage>::ImageDimension>,
00061     TOutput > Superclass;
00062 
00064   typedef SmartPointer<Self>        Pointer;
00065   typedef SmartPointer<const Self>  ConstPointer;
00066 
00068   itkNewMacro(Self);
00069 
00071   itkTypeMacro( DiscreteHessianGaussianImageFunction, ImageFunction );
00072 
00074   typedef typename Superclass::InputImageType       InputImageType;
00075   typedef typename Superclass::InputPixelType       InputPixelType;
00076   typedef typename Superclass::IndexType            IndexType;
00077   typedef typename Superclass::IndexValueType       IndexValueType;
00078   typedef typename Superclass::ContinuousIndexType  ContinuousIndexType;
00079   typedef typename Superclass::PointType            PointType;
00080 
00082   itkStaticConstMacro(ImageDimension2, unsigned int,
00083                       InputImageType::ImageDimension);
00084 
00086   typedef SymmetricSecondRankTensor<TOutput,
00087     ::itk::GetImageDimension<TInputImage>::ImageDimension>  TensorType;
00088   typedef typename Superclass::OutputType                   OutputType;
00089 
00090   typedef FixedArray<double,itkGetStaticConstMacro(ImageDimension2)>  VarianceArrayType;
00091 
00092   typedef itk::GaussianDerivativeOperator<TOutput,
00093     itkGetStaticConstMacro(ImageDimension2)>            GaussianDerivativeOperatorType;
00094 
00097   typedef FixedArray<GaussianDerivativeOperatorType,
00098     3*itkGetStaticConstMacro(ImageDimension2)>          GaussianDerivativeOperatorArrayType;
00099 
00100   typedef Neighborhood<TOutput,itkGetStaticConstMacro(ImageDimension2)>  KernelType;
00101 
00104   typedef FixedArray<KernelType,itkGetStaticConstMacro(ImageDimension2)*
00105     (itkGetStaticConstMacro(ImageDimension2)+1)/2>      KernelArrayType;
00106 
00109   typedef NeighborhoodOperatorImageFunction
00110     <InputImageType, TOutput>                           OperatorImageFunctionType;
00111   typedef typename OperatorImageFunctionType::Pointer   OperatorImageFunctionPointer;
00112 
00114   enum InterpolationModeType { NearestNeighbourInterpolation, LinearInterpolation };
00115 
00116 public:
00117 
00119   virtual OutputType Evaluate(const PointType& point) const;
00120 
00122   virtual OutputType EvaluateAtIndex( const IndexType & index ) const;
00123 
00125   virtual OutputType EvaluateAtContinuousIndex(
00126     const ContinuousIndexType & index ) const;
00127 
00132   itkSetMacro( Variance, VarianceArrayType );
00133   itkGetConstMacro( Variance, const VarianceArrayType );
00134   itkSetVectorMacro( Variance, double, VarianceArrayType::Length );
00136 
00138   virtual void SetVariance( double variance )
00139     {
00140     m_Variance.Fill( variance );
00141     this->Modified();
00142     }
00144 
00146   void SetSigma( const double sigma )
00147     {
00148     SetVariance( sigma * sigma );
00149     }
00150 
00156   itkSetClampMacro( MaximumError, double, 0.00001, 0.99999 );
00157   itkGetConstMacro( MaximumError, double );
00159 
00163   itkSetMacro( NormalizeAcrossScale, bool );
00164   itkGetConstMacro( NormalizeAcrossScale, bool );
00165   itkBooleanMacro( NormalizeAcrossScale );
00167 
00169   itkSetMacro( UseImageSpacing, bool );
00170   itkGetConstMacro( UseImageSpacing, bool );
00171   itkBooleanMacro( UseImageSpacing );
00173 
00178   itkSetMacro( MaximumKernelWidth, unsigned int );
00179   itkGetConstMacro( MaximumKernelWidth, unsigned int );
00181 
00183   itkSetMacro( InterpolationMode, InterpolationModeType );
00184   itkGetConstMacro( InterpolationMode, InterpolationModeType );
00186 
00191   virtual void SetInputImage( const InputImageType * ptr );
00192 
00195   virtual void Initialize( ) { RecomputeGaussianKernel(); }
00196 
00197 protected:
00198 
00199   DiscreteHessianGaussianImageFunction();
00200   DiscreteHessianGaussianImageFunction( const Self& ){};
00201 
00202   ~DiscreteHessianGaussianImageFunction(){};
00203 
00204   void operator=( const Self& ){};
00205   void PrintSelf(std::ostream& os, Indent indent) const;
00206 
00207   void RecomputeGaussianKernel();
00208 
00209 private:
00210 
00212   VarianceArrayType m_Variance;
00213 
00216   double m_MaximumError;
00217 
00221   unsigned int m_MaximumKernelWidth;
00222 
00227   mutable GaussianDerivativeOperatorArrayType m_OperatorArray;
00228 
00232   KernelArrayType m_KernelArray;
00233 
00235   OperatorImageFunctionPointer m_OperatorImageFunction;
00236 
00238   bool m_NormalizeAcrossScale;
00239 
00241   bool m_UseImageSpacing;
00242 
00244   InterpolationModeType m_InterpolationMode;
00245 
00246 };
00247 
00248 } // namespace itk
00249 
00250 // Define instantiation macro for this template.
00251 #define ITK_TEMPLATE_DiscreteHessianGaussianImageFunction(_, EXPORT, x, y) namespace itk { \
00252   _(2(class EXPORT DiscreteHessianGaussianImageFunction< ITK_TEMPLATE_2 x >)) \
00253   namespace Templates { typedef DiscreteHessianGaussianImageFunction< ITK_TEMPLATE_2 x > \
00254                                                   DiscreteHessianGaussianImageFunction##y; } \
00255   }
00256 
00257 #if ITK_TEMPLATE_EXPLICIT
00258 # include "Templates/itkDiscreteHessianGaussianImageFunction+-.h"
00259 #endif
00260 
00261 #if ITK_TEMPLATE_TXX
00262 # include "itkDiscreteHessianGaussianImageFunction.txx"
00263 #endif
00264 
00265 #endif
00266 

Generated at Fri Apr 16 18:14:56 2010 for ITK by doxygen 1.6.1 written by Dimitri van Heesch, © 1997-2000