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,
00069 InputImageType::ImageDimension);
00070
00071 typedef GaussianOperator<TOutput,
00072 itkGetStaticConstMacro(ImageDimension)>
00073 GaussianOperatorType;
00074 typedef Neighborhood<TOutput, itkGetStaticConstMacro(ImageDimension)> NeighborhoodType;
00075 typedef FixedArray<NeighborhoodType,itkGetStaticConstMacro(ImageDimension)> OperatorArrayType;
00076
00077 typedef GaussianSpatialFunction<TOutput,1> GaussianFunctionType;
00078 typedef typename GaussianFunctionType::Pointer GaussianFunctionPointer;
00079 typedef itk::Image<double,itkGetStaticConstMacro(ImageDimension)> InternalImageType;
00080 typedef typename InternalImageType::Pointer InternalImagePointer;
00081
00082 typedef NeighborhoodOperatorImageFunction<InternalImageType,
00083 TOutput> OperatorImageFunctionType;
00084 typedef typename OperatorImageFunctionType::Pointer OperatorImageFunctionPointer;
00085
00086 typedef itk::CastImageFilter<InputImageType,InternalImageType> CastImageFilterType;
00087 typedef typename CastImageFilterType::Pointer CastImageFilterPointer;
00088
00089 typedef itk::FixedArray< double,
00090 itkGetStaticConstMacro(ImageDimension) > ErrorArrayType;
00091
00092 typedef itk::FixedArray< double,
00093 itkGetStaticConstMacro(ImageDimension) > ExtentArrayType;
00094
00095 typedef itk::FixedArray< double,
00096 itkGetStaticConstMacro(ImageDimension) > SigmaArrayType;
00097
00099 typedef typename Superclass::PointType PointType;
00100
00102 virtual TOutput Evaluate(const PointType& point) const;
00103
00104
00106 virtual TOutput EvaluateAtIndex( const IndexType & index ) const;
00107
00109 virtual TOutput EvaluateAtContinuousIndex(
00110 const ContinuousIndexType & index ) const;
00111
00118 void SetSigma( const double* sigma);
00119 void SetSigma( const float* sigma);
00120 void SetSigma( const double sigma);
00121 itkSetMacro( Sigma, SigmaArrayType );
00122 itkGetConstReferenceMacro( Sigma, SigmaArrayType );
00123
00128 virtual void SetInputImage( const InputImageType * ptr );
00129
00133 itkSetMacro( Extent, ExtentArrayType );
00134 itkGetConstReferenceMacro( Extent, ExtentArrayType );
00135 void SetExtent( const double* extent);
00136 void SetExtent( const double extent);
00137
00141 itkSetMacro( MaximumError, ErrorArrayType );
00142 itkGetConstReferenceMacro( MaximumError, ErrorArrayType );
00143
00148 itkSetMacro( MaximumKernelWidth, int );
00149 itkGetMacro( MaximumKernelWidth, int );
00150
00156 itkSetMacro( UseImageSpacing, bool );
00157 itkGetMacro( UseImageSpacing, bool );
00158 itkBooleanMacro( UseImageSpacing );
00159
00160
00161 protected:
00162 GaussianBlurImageFunction();
00163 GaussianBlurImageFunction( const Self& ){};
00164
00165 ~GaussianBlurImageFunction(){};
00166
00167 void operator=( const Self& ){};
00168 void PrintSelf(std::ostream& os, Indent indent) const;
00169
00170 void RecomputeGaussianKernel();
00171 void RecomputeContinuousGaussianKernel(const double* offset) const;
00172
00173 private:
00174
00175 SigmaArrayType m_Sigma;
00176 OperatorImageFunctionPointer m_OperatorImageFunction;
00177 mutable OperatorArrayType m_OperatorArray;
00178 mutable OperatorArrayType m_ContinuousOperatorArray;
00179 InternalImagePointer m_InternalImage;
00180 CastImageFilterPointer m_Caster;
00181
00185 ErrorArrayType m_MaximumError;
00186 ExtentArrayType m_Extent;
00187
00190 int m_MaximumKernelWidth;
00191
00193 unsigned int m_FilterDimensionality;
00194
00196 bool m_UseImageSpacing;
00197
00199 GaussianFunctionPointer m_GaussianFunction;
00200 };
00201
00202 }
00203
00204 #ifndef ITK_MANUAL_INSTANTIATION
00205 #include "itkGaussianBlurImageFunction.txx"
00206 #endif
00207
00208 #endif
00209