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 }
00081
00083 Self &operator=(const Self &other)
00084 {
00085 Superclass::operator=(other);
00086 m_Variance = other.m_Variance;
00087 m_MaximumError = other.m_MaximumError;
00088 m_MaximumKernelWidth = other.m_MaximumKernelWidth;
00089 return *this;
00090 }
00092
00094 void SetVariance(const double &variance)
00095 { m_Variance = variance; }
00096
00101 void SetMaximumError(const double &max_error)
00102 {
00103 if (max_error >= 1 || max_error <= 0)
00104 {
00105 throw ExceptionObject(__FILE__, __LINE__);
00106 }
00107
00108 m_MaximumError = max_error;
00109 }
00110
00112 double GetVariance()
00113 { return m_Variance; }
00114
00119 double GetMaximumError()
00120 { return m_MaximumError; }
00121
00126 void SetMaximumKernelWidth( unsigned int n )
00127 { m_MaximumKernelWidth = n; }
00128
00130 unsigned int GetMaximumKernelWidth() const
00131 { return m_MaximumKernelWidth; }
00132
00134 virtual void PrintSelf(std::ostream &os, Indent i) const
00135 {
00136 os << i << "GaussianOperator { this=" << this
00137 << ", m_Variance = " << m_Variance
00138 << ", m_MaximumError = " << m_MaximumError
00139 << "} " << std::endl;
00140 Superclass::PrintSelf(os, i.GetNextIndent());
00141 }
00143
00144 protected:
00145 typedef typename Superclass::CoefficientVector CoefficientVector;
00146
00148 double ModifiedBesselI0(double);
00149
00152 double ModifiedBesselI1(double);
00153
00156 double ModifiedBesselI(int, double);
00157
00159 CoefficientVector GenerateCoefficients();
00160
00162 void Fill(const CoefficientVector& coeff)
00163 { this->FillCenteredDirectional(coeff); }
00164
00165 private:
00167 double m_Variance;
00168
00171 double m_MaximumError;
00172
00176 unsigned int m_MaximumKernelWidth;
00177
00179 const char *GetNameOfClass()
00180 { return "itkGaussianOperator"; }
00181
00182 };
00183
00184 }
00185
00186
00187 #define ITK_TEMPLATE_GaussianOperator(_, EXPORT, x, y) namespace itk { \
00188 _(2(class EXPORT GaussianOperator< ITK_TEMPLATE_2 x >)) \
00189 namespace Templates { typedef GaussianOperator< ITK_TEMPLATE_2 x > \
00190 GaussianOperator##y; } \
00191 }
00192
00193 #if ITK_TEMPLATE_EXPLICIT
00194 # include "Templates/itkGaussianOperator+-.h"
00195 #endif
00196
00197 #if ITK_TEMPLATE_TXX
00198 # include "itkGaussianOperator.txx"
00199 #endif
00200
00201 #endif
00202