itkGaussianBlurImageFunction.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 #ifndef __itkGaussianBlurImageFunction_h
00018 #define __itkGaussianBlurImageFunction_h
00019
00020 #include "itkNeighborhoodOperatorImageFunction.h"
00021 #include "itkGaussianOperator.h"
00022 #include "itkGaussianSpatialFunction.h"
00023 #include "itkImageFunction.h"
00024 #include "itkCastImageFilter.h"
00025
00026 namespace itk
00027 {
00028
00038 template <class TInputImage,class TOutput=double>
00039 class ITK_EXPORT GaussianBlurImageFunction :
00040 public ImageFunction< TInputImage, TOutput >
00041 {
00042 public:
00043
00045 typedef GaussianBlurImageFunction Self;
00046
00048 typedef ImageFunction<TInputImage, TOutput> Superclass;
00049
00051 typedef SmartPointer<Self> Pointer;
00052 typedef SmartPointer<const Self> ConstPointer;
00053
00055 itkNewMacro(Self);
00056
00058 itkTypeMacro( GaussianBlurImageFunction, ImageFunction );
00059
00061 typedef TInputImage InputImageType;
00062 typedef typename InputImageType::PixelType InputPixelType;
00063 typedef typename Superclass::IndexType IndexType;
00064 typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
00065
00066
00068 itkStaticConstMacro(ImageDimension, unsigned int, InputImageType::ImageDimension);
00069
00070 typedef GaussianOperator<
00071 TOutput, itkGetStaticConstMacro(ImageDimension)> GaussianOperatorType;
00072 typedef Neighborhood<TOutput, itkGetStaticConstMacro(ImageDimension)> NeighborhoodType;
00073 typedef FixedArray<NeighborhoodType,itkGetStaticConstMacro(ImageDimension)> OperatorArrayType;
00074
00075 typedef GaussianSpatialFunction<TOutput,1> GaussianFunctionType;
00076 typedef typename GaussianFunctionType::Pointer GaussianFunctionPointer;
00077 typedef itk::Image<double,itkGetStaticConstMacro(ImageDimension)> InternalImageType;
00078 typedef typename InternalImageType::Pointer InternalImagePointer;
00079
00080 typedef NeighborhoodOperatorImageFunction< InternalImageType, TOutput> OperatorImageFunctionType;
00081 typedef typename OperatorImageFunctionType::Pointer OperatorImageFunctionPointer;
00082
00083 typedef itk::CastImageFilter<InputImageType,InternalImageType> CastImageFilterType;
00084 typedef typename CastImageFilterType::Pointer CastImageFilterPointer;
00085
00086 typedef itk::FixedArray< double, itkGetStaticConstMacro(ImageDimension) > ErrorArrayType;
00087 typedef itk::FixedArray< double, itkGetStaticConstMacro(ImageDimension) > ExtentArrayType;
00088 typedef itk::FixedArray< double, itkGetStaticConstMacro(ImageDimension) > SigmaArrayType;
00089
00091 typedef typename Superclass::PointType PointType;
00092
00094 virtual TOutput Evaluate(const PointType& point) const;
00095
00096
00098 virtual TOutput EvaluateAtIndex( const IndexType & index ) const;
00099
00101 virtual TOutput EvaluateAtContinuousIndex(
00102 const ContinuousIndexType & index ) const;
00103
00110 void SetSigma( const double* sigma);
00111 void SetSigma( const float* sigma);
00112 void SetSigma( const double sigma);
00113 itkSetMacro( Sigma, SigmaArrayType );
00114 itkGetConstReferenceMacro( Sigma, SigmaArrayType );
00116
00121 virtual void SetInputImage( const InputImageType * ptr );
00122
00126 itkSetMacro( Extent, ExtentArrayType );
00127 itkGetConstReferenceMacro( Extent, ExtentArrayType );
00128 void SetExtent( const double* extent);
00129 void SetExtent( const double extent);
00131
00135 itkSetMacro( MaximumError, ErrorArrayType );
00136 itkGetConstReferenceMacro( MaximumError, ErrorArrayType );
00138
00143 itkSetMacro( MaximumKernelWidth, int );
00144 itkGetMacro( MaximumKernelWidth, int );
00146
00152 itkSetMacro( UseImageSpacing, bool );
00153 itkGetMacro( UseImageSpacing, bool );
00154 itkBooleanMacro( UseImageSpacing );
00156
00157
00158 protected:
00159 GaussianBlurImageFunction();
00160 GaussianBlurImageFunction( const Self& ){};
00161
00162 ~GaussianBlurImageFunction(){};
00163
00164 void operator=( const Self& ){};
00165 void PrintSelf(std::ostream& os, Indent indent) const;
00166
00167 void RecomputeGaussianKernel();
00168 void RecomputeContinuousGaussianKernel(const double* offset) const;
00169
00170 private:
00171
00172 SigmaArrayType m_Sigma;
00173 OperatorImageFunctionPointer m_OperatorImageFunction;
00174 mutable OperatorArrayType m_OperatorArray;
00175 mutable OperatorArrayType m_ContinuousOperatorArray;
00176 InternalImagePointer m_InternalImage;
00177 CastImageFilterPointer m_Caster;
00178
00182 ErrorArrayType m_MaximumError;
00183 ExtentArrayType m_Extent;
00184
00187 int m_MaximumKernelWidth;
00188
00190 unsigned int m_FilterDimensionality;
00191
00193 bool m_UseImageSpacing;
00194
00196 GaussianFunctionPointer m_GaussianFunction;
00197 };
00198
00199 }
00200
00201
00202 #define ITK_TEMPLATE_GaussianBlurImageFunction(_, EXPORT, x, y) namespace itk { \
00203 _(2(class EXPORT GaussianBlurImageFunction< ITK_TEMPLATE_2 x >)) \
00204 namespace Templates { typedef GaussianBlurImageFunction< ITK_TEMPLATE_2 x > \
00205 GaussianBlurImageFunction##y; } \
00206 }
00207
00208 #if ITK_TEMPLATE_EXPLICIT
00209 # include "Templates/itkGaussianBlurImageFunction+-.h"
00210 #endif
00211
00212 #if ITK_TEMPLATE_TXX
00213 # include "itkGaussianBlurImageFunction.txx"
00214 #endif
00215
00216 #endif
00217