00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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
00102 typedef FixedArray<KernelType,itkGetStaticConstMacro(ImageDimension2)*
00103 (itkGetStaticConstMacro(ImageDimension2)+1)/2> KernelArrayType;
00104
00106 typedef NeighborhoodOperatorImageFunction
00107 <InputImageType, TOutput> OperatorImageFunctionType;
00108 typedef typename OperatorImageFunctionType::Pointer OperatorImageFunctionPointer;
00109
00111 enum InterpolationModeType { NearestNeighbourInterpolation, LinearInterpolation };
00112
00113 public:
00114
00116 virtual OutputType Evaluate(const PointType& point) const;
00117
00119 virtual OutputType EvaluateAtIndex( const IndexType & index ) const;
00120
00122 virtual OutputType EvaluateAtContinuousIndex(
00123 const ContinuousIndexType & index ) const;
00124
00129 itkSetMacro( Variance, VarianceArrayType );
00130 itkGetMacro( Variance, const VarianceArrayType );
00131 itkSetVectorMacro( Variance, double, VarianceArrayType::Length );
00133
00135 virtual void SetVariance( double variance )
00136 {
00137 m_Variance.Fill( variance );
00138 this->Modified();
00139 }
00141
00143 void SetSigma( const double sigma )
00144 {
00145 SetVariance( sigma * sigma );
00146 }
00147
00152 itkSetClampMacro( MaximumError, double, 0.00001, 0.99999 );
00153 itkGetMacro( MaximumError, double );
00155
00158 itkSetMacro( NormalizeAcrossScale, bool );
00159 itkGetMacro( NormalizeAcrossScale, bool );
00160 itkBooleanMacro( NormalizeAcrossScale );
00162
00164 itkSetMacro( UseImageSpacing, bool );
00165 itkGetMacro( UseImageSpacing, bool );
00166 itkBooleanMacro( UseImageSpacing );
00168
00173 itkSetMacro( MaximumKernelWidth, unsigned int );
00174 itkGetMacro( MaximumKernelWidth, unsigned int );
00176
00178 itkSetMacro( InterpolationMode, InterpolationModeType );
00179 itkGetMacro( InterpolationMode, InterpolationModeType );
00181
00186 virtual void SetInputImage( const InputImageType * ptr );
00187
00190 virtual void Initialize( ) { RecomputeGaussianKernel(); }
00191
00192 protected:
00193
00194 DiscreteHessianGaussianImageFunction();
00195 DiscreteHessianGaussianImageFunction( const Self& ){};
00196
00197 ~DiscreteHessianGaussianImageFunction(){};
00198
00199 void operator=( const Self& ){};
00200 void PrintSelf(std::ostream& os, Indent indent) const;
00201
00202 void RecomputeGaussianKernel();
00203
00204 private:
00205
00207 VarianceArrayType m_Variance;
00208
00211 double m_MaximumError;
00212
00216 unsigned int m_MaximumKernelWidth;
00217
00221 mutable GaussianDerivativeOperatorArrayType m_OperatorArray;
00222
00225 KernelArrayType m_KernelArray;
00226
00228 OperatorImageFunctionPointer m_OperatorImageFunction;
00229
00231 bool m_NormalizeAcrossScale;
00232
00234 bool m_UseImageSpacing;
00235
00237 InterpolationModeType m_InterpolationMode;
00238
00239 };
00240
00241 }
00242
00243
00244 #define ITK_TEMPLATE_DiscreteHessianGaussianImageFunction(_, EXPORT, x, y) namespace itk { \
00245 _(2(class EXPORT DiscreteHessianGaussianImageFunction< ITK_TEMPLATE_2 x >)) \
00246 namespace Templates { typedef DiscreteHessianGaussianImageFunction< ITK_TEMPLATE_2 x > \
00247 DiscreteHessianGaussianImageFunction##y; } \
00248 }
00249
00250 #if ITK_TEMPLATE_EXPLICIT
00251 # include "Templates/itkDiscreteHessianGaussianImageFunction+-.h"
00252 #endif
00253
00254 #if ITK_TEMPLATE_TXX
00255 # include "itkDiscreteHessianGaussianImageFunction.txx"
00256 #endif
00257
00258 #endif
00259