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 m_MaximumKernelWidth = other.m_MaximumKernelWidth;
00079 }
00080
00082 Self &operator=(const Self &other)
00083 {
00084 Superclass::operator=(other);
00085 m_Variance = other.m_Variance;
00086 m_MaximumError = other.m_MaximumError;
00087 m_MaximumKernelWidth = other.m_MaximumKernelWidth;
00088 return *this;
00089 }
00090
00092 void SetVariance(const double &variance)
00093 { m_Variance = variance; }
00094
00099 void SetMaximumError(const double &max_error)
00100 {
00101 if (max_error >= 1 || max_error <= 0)
00102 {
00103 throw ExceptionObject(__FILE__, __LINE__);
00104 }
00105
00106 m_MaximumError = max_error;
00107 }
00108
00110 double GetVariance()
00111 { return m_Variance; }
00112
00117 double GetMaximumError()
00118 { return m_MaximumError; }
00119
00124 void SetMaximumKernelWidth( unsigned int n )
00125 { m_MaximumKernelWidth = n; }
00126
00128 unsigned int GetMaximumKernelWidth() const
00129 { return m_MaximumKernelWidth; }
00130
00132 virtual void PrintSelf(std::ostream &os, Indent i) const
00133 {
00134 os << i << "GaussianOperator { this=" << this
00135 << ", m_Variance = " << m_Variance
00136 << ", m_MaximumError = " << m_MaximumError
00137 << "} " << std::endl;
00138 Superclass::PrintSelf(os, i.GetNextIndent());
00139 }
00140
00141 protected:
00142 typedef typename Superclass::CoefficientVector CoefficientVector;
00143
00145 double ModifiedBesselI0(double);
00146
00149 double ModifiedBesselI1(double);
00150
00153 double ModifiedBesselI(int, double);
00154
00156 CoefficientVector GenerateCoefficients();
00157
00159 void Fill(const CoefficientVector& coeff)
00160 { this->FillCenteredDirectional(coeff); }
00161
00162 private:
00164 double m_Variance;
00165
00168 double m_MaximumError;
00169
00173 unsigned int m_MaximumKernelWidth;
00174
00176 const char *GetNameOfClass()
00177 { return "itkGaussianOperator"; }
00178
00179 };
00180
00181 }
00182
00183
00184 #ifndef ITK_MANUAL_INSTANTIATION
00185 #include "itkGaussianOperator.txx"
00186 #endif
00187
00188 #endif