00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkGaussianOperator_h
00018 #define __itkGaussianOperator_h
00019
00020 #include "itkNeighborhoodOperator.h"
00021 #include <math.h>
00022 namespace itk {
00023
00059 template<class TPixel,unsigned int VDimension=2,
00060 class TAllocator = NeighborhoodAllocator<TPixel> >
00061 class ITK_EXPORT GaussianOperator
00062 : public NeighborhoodOperator<TPixel, VDimension, TAllocator>
00063 {
00064 public:
00066 typedef GaussianOperator Self;
00067 typedef NeighborhoodOperator<TPixel, VDimension, TAllocator> Superclass;
00068
00070 GaussianOperator() : m_Variance(1), m_MaximumError(.01), m_MaximumKernelWidth(30) { }
00071
00073 GaussianOperator(const Self &other)
00074 : NeighborhoodOperator<TPixel, VDimension, TAllocator>(other)
00075 {
00076 m_Variance = other.m_Variance;
00077 m_MaximumError = other.m_MaximumError;
00078 }
00079
00081 Self &operator=(const Self &other)
00082 {
00083 Superclass::operator=(other);
00084 m_Variance = other.m_Variance;
00085 m_MaximumError = other.m_MaximumError;
00086 return *this;
00087 }
00088
00090 void SetVariance(const double &variance)
00091 { m_Variance = variance; }
00092
00097 void SetMaximumError(const double &max_error)
00098 {
00099 if (max_error >= 1 || max_error <= 0)
00100 {
00101 throw ExceptionObject(__FILE__, __LINE__);
00102 }
00103
00104 m_MaximumError = max_error;
00105 }
00106
00108 double GetVariance()
00109 { return m_Variance; }
00110
00115 double GetMaximumError()
00116 { return m_MaximumError; }
00117
00122 void SetMaximumKernelWidth( unsigned int n )
00123 { m_MaximumKernelWidth = n; }
00124
00126 unsigned int GetMaximumKernelWidth() const
00127 { return m_MaximumKernelWidth; }
00128
00130 virtual void PrintSelf(std::ostream &os, Indent i) const
00131 {
00132 os << i << "GaussianOperator { this=" << this
00133 << ", m_Variance = " << m_Variance
00134 << ", m_MaximumError = " << m_MaximumError
00135 << "} " << std::endl;
00136 Superclass::PrintSelf(os, i.GetNextIndent());
00137 }
00138
00139 protected:
00140 typedef typename Superclass::CoefficientVector CoefficientVector;
00141
00143 double ModifiedBesselI0(double);
00144
00147 double ModifiedBesselI1(double);
00148
00151 double ModifiedBesselI(int, double);
00152
00154 CoefficientVector GenerateCoefficients();
00155
00157 void Fill(const CoefficientVector& coeff)
00158 { this->FillCenteredDirectional(coeff); }
00159
00160 private:
00162 double m_Variance;
00163
00166 double m_MaximumError;
00167
00171 unsigned int m_MaximumKernelWidth;
00172
00174 const char *GetNameOfClass()
00175 { return "itkGaussianOperator"; }
00176
00177 };
00178
00179 }
00180
00181
00182 #ifndef ITK_MANUAL_INSTANTIATION
00183 #include "itkGaussianOperator.txx"
00184 #endif
00185
00186 #endif