itkDiscreteGaussianDerivativeImageFunction.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
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::IndexValueType IndexValueType;
00075 typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
00076 typedef typename Superclass::PointType PointType;
00077
00079 itkStaticConstMacro(ImageDimension2, unsigned int,
00080 InputImageType::ImageDimension);
00081
00083 typedef typename Superclass::OutputType OutputType;
00084
00086 typedef FixedArray<double,itkGetStaticConstMacro(ImageDimension2)> VarianceArrayType;
00087 typedef FixedArray<unsigned int,itkGetStaticConstMacro(ImageDimension2)> OrderArrayType;
00089
00090 typedef itk::GaussianDerivativeOperator<TOutput,
00091 itkGetStaticConstMacro(ImageDimension2)> GaussianDerivativeOperatorType;
00092
00094 typedef FixedArray<GaussianDerivativeOperatorType,
00095 itkGetStaticConstMacro(ImageDimension2)> GaussianDerivativeOperatorArrayType;
00096
00098 typedef Neighborhood<TOutput,itkGetStaticConstMacro(ImageDimension2)> KernelType;
00099
00101 typedef NeighborhoodOperatorImageFunction
00102 <InputImageType, TOutput> OperatorImageFunctionType;
00103 typedef typename OperatorImageFunctionType::Pointer OperatorImageFunctionPointer;
00104
00106 enum InterpolationModeType { NearestNeighbourInterpolation, LinearInterpolation };
00107
00108 public:
00109
00111 virtual OutputType Evaluate(const PointType& point) const;
00112
00114 virtual OutputType EvaluateAtIndex( const IndexType & index ) const;
00115
00117 virtual OutputType EvaluateAtContinuousIndex(
00118 const ContinuousIndexType & index ) const;
00119
00126 itkSetMacro( Variance, VarianceArrayType );
00127 itkGetConstMacro( 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
00142 void SetSigma( const double sigma )
00143 {
00144 SetVariance( sigma * sigma );
00145 }
00146
00153 itkSetClampMacro( MaximumError, double, 0.00001, 0.99999 );
00154 itkGetConstMacro( MaximumError, double );
00156
00158 itkSetMacro( Order, OrderArrayType );
00159 itkGetConstMacro( Order, const OrderArrayType );
00160 itkSetVectorMacro( Order, unsigned int, OrderArrayType::Length );
00162
00164 virtual void SetOrder( unsigned int order )
00165 {
00166 m_Order.Fill( order );
00167 this->Modified();
00168 }
00170
00174 itkSetMacro( NormalizeAcrossScale, bool );
00175 itkGetConstMacro( NormalizeAcrossScale, bool );
00176 itkBooleanMacro( NormalizeAcrossScale );
00178
00180 itkSetMacro( UseImageSpacing, bool );
00181 itkGetConstMacro( UseImageSpacing, bool );
00182 itkBooleanMacro( UseImageSpacing );
00184
00189 itkSetMacro( MaximumKernelWidth, unsigned int );
00190 itkGetConstMacro( MaximumKernelWidth, unsigned int );
00192
00194 itkSetMacro( InterpolationMode, InterpolationModeType );
00195 itkGetConstMacro( InterpolationMode, InterpolationModeType );
00197
00202 virtual void SetInputImage( const InputImageType * ptr );
00203
00207 virtual void Initialize( ) { RecomputeGaussianKernel(); }
00208
00209 protected:
00210
00211 DiscreteGaussianDerivativeImageFunction();
00212 DiscreteGaussianDerivativeImageFunction( const Self& ){};
00213
00214 ~DiscreteGaussianDerivativeImageFunction(){};
00215
00216 void operator=( const Self& ){};
00217 void PrintSelf(std::ostream& os, Indent indent) const;
00218
00219 void RecomputeGaussianKernel();
00220
00221 private:
00222
00224 VarianceArrayType m_Variance;
00225
00227 OrderArrayType m_Order;
00228
00231 double m_MaximumError;
00232
00236 unsigned int m_MaximumKernelWidth;
00237
00239 GaussianDerivativeOperatorArrayType m_OperatorArray;
00240
00243 KernelType m_DerivativeKernel;
00244
00246 OperatorImageFunctionPointer m_OperatorImageFunction;
00247
00249 bool m_NormalizeAcrossScale;
00250
00252 bool m_UseImageSpacing;
00253
00255 InterpolationModeType m_InterpolationMode;
00256
00257 };
00258
00259 }
00260
00261
00262 #define ITK_TEMPLATE_DiscreteGaussianDerivativeImageFunction(_, EXPORT, x, y) namespace itk { \
00263 _(2(class EXPORT DiscreteGaussianDerivativeImageFunction< ITK_TEMPLATE_2 x >)) \
00264 namespace Templates { typedef DiscreteGaussianDerivativeImageFunction< ITK_TEMPLATE_2 x > \
00265 DiscreteGaussianDerivativeImageFunction##y; } \
00266 }
00267
00268 #if ITK_TEMPLATE_EXPLICIT
00269 # include "Templates/itkDiscreteGaussianDerivativeImageFunction+-.h"
00270 #endif
00271
00272 #if ITK_TEMPLATE_TXX
00273 # include "itkDiscreteGaussianDerivativeImageFunction.txx"
00274 #endif
00275
00276 #endif
00277