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 m_MaximumKernelWidth = other.m_MaximumKernelWidth;
00087 return *this;
00088 }
00089
00091 void SetVariance(const double &variance)
00092 { m_Variance = variance; }
00093
00098 void SetMaximumError(const double &max_error)
00099 {
00100 if (max_error >= 1 || max_error <= 0)
00101 {
00102 throw ExceptionObject(__FILE__, __LINE__);
00103 }
00104
00105 m_MaximumError = max_error;
00106 }
00107
00109 double GetVariance()
00110 { return m_Variance; }
00111
00116 double GetMaximumError()
00117 { return m_MaximumError; }
00118
00123 void SetMaximumKernelWidth( unsigned int n )
00124 { m_MaximumKernelWidth = n; }
00125
00127 unsigned int GetMaximumKernelWidth() const
00128 { return m_MaximumKernelWidth; }
00129
00131 virtual void PrintSelf(std::ostream &os, Indent i) const
00132 {
00133 os << i << "GaussianOperator { this=" << this
00134 << ", m_Variance = " << m_Variance
00135 << ", m_MaximumError = " << m_MaximumError
00136 << "} " << std::endl;
00137 Superclass::PrintSelf(os, i.GetNextIndent());
00138 }
00139
00140 protected:
00141 typedef typename Superclass::CoefficientVector CoefficientVector;
00142
00144 double ModifiedBesselI0(double);
00145
00148 double ModifiedBesselI1(double);
00149
00152 double ModifiedBesselI(int, double);
00153
00155 CoefficientVector GenerateCoefficients();
00156
00158 void Fill(const CoefficientVector& coeff)
00159 { this->FillCenteredDirectional(coeff); }
00160
00161 private:
00163 double m_Variance;
00164
00167 double m_MaximumError;
00168
00172 unsigned int m_MaximumKernelWidth;
00173
00175 const char *GetNameOfClass()
00176 { return "itkGaussianOperator"; }
00177
00178 };
00179
00180 }
00181
00182
00183 #ifndef ITK_MANUAL_INSTANTIATION
00184 #include "itkGaussianOperator.txx"
00185 #endif
00186
00187 #endif