Go to the documentation of this file.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 {
00096 m_Variance = variance;
00097 }
00098
00103 void SetMaximumError(const double &max_error)
00104 {
00105 if (max_error >= 1 || max_error <= 0)
00106 {
00107 itkExceptionMacro("Maximum Error Must be in the range [ 0.0 , 1.0 ]");
00108 }
00109
00110 m_MaximumError = max_error;
00111 }
00112
00114 double GetVariance()
00115 { return m_Variance; }
00116
00121 double GetMaximumError()
00122 { return m_MaximumError; }
00123
00128 void SetMaximumKernelWidth( unsigned int n )
00129 { m_MaximumKernelWidth = n; }
00130
00132 unsigned int GetMaximumKernelWidth() const
00133 { return m_MaximumKernelWidth; }
00134
00136 virtual void PrintSelf(std::ostream &os, Indent i) const
00137 {
00138 os << i << "GaussianOperator { this=" << this
00139 << ", m_Variance = " << m_Variance
00140 << ", m_MaximumError = " << m_MaximumError
00141 << "} " << std::endl;
00142 Superclass::PrintSelf(os, i.GetNextIndent());
00143 }
00145
00146 protected:
00147 typedef typename Superclass::CoefficientVector CoefficientVector;
00148
00150 double ModifiedBesselI0(double);
00151
00154 double ModifiedBesselI1(double);
00155
00158 double ModifiedBesselI(int, double);
00159
00161 CoefficientVector GenerateCoefficients();
00162
00164 void Fill(const CoefficientVector& coeff)
00165 { this->FillCenteredDirectional(coeff); }
00166
00167 private:
00169 double m_Variance;
00170
00173 double m_MaximumError;
00174
00178 unsigned int m_MaximumKernelWidth;
00179
00181 const char *GetNameOfClass()
00182 { return "itkGaussianOperator"; }
00183
00184 };
00185
00186 }
00187
00188
00189 #define ITK_TEMPLATE_GaussianOperator(_, EXPORT, x, y) namespace itk { \
00190 _(2(class EXPORT GaussianOperator< ITK_TEMPLATE_2 x >)) \
00191 namespace Templates { typedef GaussianOperator< ITK_TEMPLATE_2 x > \
00192 GaussianOperator##y; } \
00193 }
00194
00195 #if ITK_TEMPLATE_EXPLICIT
00196 # include "Templates/itkGaussianOperator+-.h"
00197 #endif
00198
00199 #if ITK_TEMPLATE_TXX
00200 # include "itkGaussianOperator.txx"
00201 #endif
00202
00203 #endif
00204