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-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 __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::ContinuousIndexType  ContinuousIndexType;
00078   typedef typename Superclass::PointType            PointType;
00079 
00081   itkStaticConstMacro(ImageDimension2, unsigned int,
00082                       InputImageType::ImageDimension);
00083 
00085   typedef SymmetricSecondRankTensor<TOutput,
00086     ::itk::GetImageDimension<TInputImage>::ImageDimension>  TensorType;
00087   typedef typename Superclass::OutputType                   OutputType;
00088 
00089   typedef FixedArray<double,itkGetStaticConstMacro(ImageDimension2)>  VarianceArrayType;
00090 
00091   typedef itk::GaussianDerivativeOperator<TOutput,
00092     itkGetStaticConstMacro(ImageDimension2)>            GaussianDerivativeOperatorType;
00093 
00096   typedef FixedArray<GaussianDerivativeOperatorType,
00097     3*itkGetStaticConstMacro(ImageDimension2)>          GaussianDerivativeOperatorArrayType;
00098 
00099   typedef Neighborhood<TOutput,itkGetStaticConstMacro(ImageDimension2)>  KernelType;
00100 
00103   typedef FixedArray<KernelType,itkGetStaticConstMacro(ImageDimension2)*
00104     (itkGetStaticConstMacro(ImageDimension2)+1)/2>      KernelArrayType;
00105 
00108   typedef NeighborhoodOperatorImageFunction
00109     <InputImageType, TOutput>                           OperatorImageFunctionType;
00110   typedef typename OperatorImageFunctionType::Pointer   OperatorImageFunctionPointer;
00111 
00113   enum InterpolationModeType { NearestNeighbourInterpolation, LinearInterpolation };
00114 
00115 public:
00116 
00118   virtual OutputType Evaluate(const PointType& point) const;
00119 
00121   virtual OutputType EvaluateAtIndex( const IndexType & index ) const;
00122 
00124   virtual OutputType EvaluateAtContinuousIndex(
00125     const ContinuousIndexType & index ) const;
00126 
00131   itkSetMacro( Variance, VarianceArrayType );
00132   itkGetConstMacro( Variance, const VarianceArrayType );
00133   itkSetVectorMacro( Variance, double, VarianceArrayType::Length );
00135 
00137   virtual void SetVariance( double variance )
00138     {
00139     m_Variance.Fill( variance );
00140     this->Modified();
00141     }
00143 
00145   void SetSigma( const double sigma )
00146     {
00147     SetVariance( sigma * sigma );
00148     }
00149 
00155   itkSetClampMacro( MaximumError, double, 0.00001, 0.99999 );
00156   itkGetConstMacro( MaximumError, double );
00158 
00162   itkSetMacro( NormalizeAcrossScale, bool );
00163   itkGetConstMacro( NormalizeAcrossScale, bool );
00164   itkBooleanMacro( NormalizeAcrossScale );
00166 
00168   itkSetMacro( UseImageSpacing, bool );
00169   itkGetConstMacro( UseImageSpacing, bool );
00170   itkBooleanMacro( UseImageSpacing );
00172 
00177   itkSetMacro( MaximumKernelWidth, unsigned int );
00178   itkGetConstMacro( MaximumKernelWidth, unsigned int );
00180 
00182   itkSetMacro( InterpolationMode, InterpolationModeType );
00183   itkGetConstMacro( InterpolationMode, InterpolationModeType );
00185 
00190   virtual void SetInputImage( const InputImageType * ptr );
00191 
00194   virtual void Initialize( ) { RecomputeGaussianKernel(); }
00195 
00196 protected:
00197 
00198   DiscreteHessianGaussianImageFunction();
00199   DiscreteHessianGaussianImageFunction( const Self& ){};
00200 
00201   ~DiscreteHessianGaussianImageFunction(){};
00202 
00203   void operator=( const Self& ){};
00204   void PrintSelf(std::ostream& os, Indent indent) const;
00205 
00206   void RecomputeGaussianKernel();
00207 
00208 private:
00209 
00211   VarianceArrayType m_Variance;
00212 
00215   double m_MaximumError;
00216 
00220   unsigned int m_MaximumKernelWidth;
00221 
00226   mutable GaussianDerivativeOperatorArrayType m_OperatorArray;
00227 
00231   KernelArrayType m_KernelArray;
00232 
00234   OperatorImageFunctionPointer m_OperatorImageFunction;
00235 
00237   bool m_NormalizeAcrossScale;
00238 
00240   bool m_UseImageSpacing;
00241 
00243   InterpolationModeType m_InterpolationMode;
00244 
00245 };
00246 
00247 } // namespace itk
00248 
00249 // Define instantiation macro for this template.
00250 #define ITK_TEMPLATE_DiscreteHessianGaussianImageFunction(_, EXPORT, x, y) namespace itk { \
00251   _(2(class EXPORT DiscreteHessianGaussianImageFunction< ITK_TEMPLATE_2 x >)) \
00252   namespace Templates { typedef DiscreteHessianGaussianImageFunction< ITK_TEMPLATE_2 x > \
00253                                                   DiscreteHessianGaussianImageFunction##y; } \
00254   }
00255 
00256 #if ITK_TEMPLATE_EXPLICIT
00257 # include "Templates/itkDiscreteHessianGaussianImageFunction+-.h"
00258 #endif
00259 
00260 #if ITK_TEMPLATE_TXX
00261 # include "itkDiscreteHessianGaussianImageFunction.txx"
00262 #endif
00263 
00264 #endif
00265 

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