Orfeo Toolbox  3.16
itkGaussianDerivativeOperator.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkGaussianDerivativeOperator.h,v $
5  Language: C++
6  Date: $Date: 2009-01-28 18:14:36 $
7  Version: $Revision: 1.4 $
8 
9  Copyright (c) Insight Software Consortium. All rights reserved.
10  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 
18 #ifndef __itkGaussianDerivativeOperator_h
19 #define __itkGaussianDerivativeOperator_h
20 
22 #include "itkGaussianOperator.h"
23 #include "itkDerivativeOperator.h"
24 #include <math.h>
25 
26 namespace itk {
27 
72 template<class TPixel,unsigned int VDimension=2,
73  class TAllocator = NeighborhoodAllocator<TPixel> >
75  : public NeighborhoodOperator<TPixel, VDimension, TAllocator>
76 {
77 public:
81 
85 
88  {
89  m_Order = 1;
90  m_Variance = 1.0;
91  m_Spacing = 1.0;
92  m_MaximumError = 0.005;
93  m_MaximumKernelWidth = 30;
94  m_UseDerivativeOperator = false;
95  m_NormalizeAcrossScale = true;
96  }
97 
100  NeighborhoodOperator<TPixel, VDimension, TAllocator>(other)
101  {
102  m_UseDerivativeOperator = other.m_UseDerivativeOperator;
103  m_NormalizeAcrossScale = other.m_NormalizeAcrossScale;
104  m_Spacing = other.m_Spacing;
105  m_Order = other.m_Order;
106  m_Variance = other.m_Variance;
107  m_MaximumError = other.m_MaximumError;
108  m_MaximumKernelWidth = other.m_MaximumKernelWidth;
109  }
110 
112  Self &operator=(const Self &other)
113  {
114  Superclass::operator=(other);
115  m_UseDerivativeOperator = other.m_UseDerivativeOperator;
116  m_NormalizeAcrossScale = other.m_NormalizeAcrossScale;
117  m_Spacing = other.m_Spacing;
118  m_Order = other.m_Order;
119  m_Variance = other.m_Variance;
120  m_MaximumError = other.m_MaximumError;
121  m_MaximumKernelWidth = other.m_MaximumKernelWidth;
122  return *this;
123  }
124 
130  void SetUseDerivativeOperator( bool flag )
131  {
132  if( m_UseDerivativeOperator != flag )
133  {
134  m_UseDerivativeOperator = flag;
135  }
136  }
137  bool GetUseDerivativeOperator() const { return m_UseDerivativeOperator; }
138  itkBooleanMacro(UseDerivativeOperator);
139 
142  void SetNormalizeAcrossScale( bool flag )
143  {
144  if( m_NormalizeAcrossScale != flag )
145  {
146  m_NormalizeAcrossScale = flag;
147  }
148  }
149  bool GetNormalizeAcrossScale() const { return m_NormalizeAcrossScale; }
150  itkBooleanMacro(NormalizeAcrossScale);
151 
153  void SetVariance(const double variance) { m_Variance = variance; }
154 
156  void SetSpacing(const double spacing)
157  {
158  m_Spacing = spacing;
159  }
160 
165  void SetMaximumError( const double maxerror )
166  {
167  const double Min = 0.00001;
168  const double Max = 1.0 - Min;
169  m_MaximumError = (maxerror<Min?Min:(maxerror>Max?Max:maxerror));
170  }
171 
173  double GetVariance() { return m_Variance; }
174 
179  double GetMaximumError() { return m_MaximumError; }
180 
185  void SetMaximumKernelWidth( unsigned int n )
186  {
187  m_MaximumKernelWidth = n;
188  }
189 
191  unsigned int GetMaximumKernelWidth() const { return m_MaximumKernelWidth; }
192 
194  void SetOrder(const unsigned int order)
195  {
196  m_Order = order;
197  }
198 
200  unsigned int GetOrder() const { return m_Order; }
201 
203  virtual void PrintSelf(std::ostream &os, Indent i) const
204  {
205  os << i << "GaussianDerivativeOperator { this=" << this
206  << ", m_UseDerivativeOperator = " << m_UseDerivativeOperator
207  << ", m_NormalizeAcrossScale = " << m_NormalizeAcrossScale
208  << ", m_Order = " << m_Order
209  << ", m_Spacing = " << m_Spacing
210  << ", m_Variance = " << m_Variance
211  << ", m_MaximumError = " << m_MaximumError
212  << ", m_MaximumKernelWidth = " << m_MaximumKernelWidth
213  << "} " << std::endl;
214  Superclass::PrintSelf(os, i.GetNextIndent());
215  }
216 
217 protected:
218 
219  typedef typename Superclass::CoefficientVector CoefficientVector;
220 
222  double ModifiedBesselI0(double);
223 
226  double ModifiedBesselI1(double);
227 
230  double ModifiedBesselI(int, double);
231 
233  CoefficientVector GenerateCoefficients();
234 
236  void Fill(const CoefficientVector& coeff)
237  { this->FillCenteredDirectional(coeff); }
238 
239 private:
240 
242  const char *GetNameOfClass()
243  { return "itkGaussianDerivativeOperator"; }
244 
247 
250 
252  double m_Variance;
253 
257 
261  unsigned int m_MaximumKernelWidth;
262 
264  unsigned int m_Order;
265 
267  double m_Spacing;
268 };
269 
270 } // namespace itk
271 
272 // Define instantiation macro for this template.
273 #define ITK_TEMPLATE_GaussianDerivativeOperator(_, EXPORT, x, y) namespace itk { \
274  _(2(class EXPORT GaussianDerivativeOperator< ITK_TEMPLATE_2 x >)) \
275  namespace Templates { typedef GaussianDerivativeOperator< ITK_TEMPLATE_2 x > \
276  GaussianDerivativeOperator##y; } \
277  }
278 
279 #if ITK_TEMPLATE_EXPLICIT
280 # include "Templates/itkGaussianDerivativeOperator+-.h"
281 #endif
282 
283 #if ITK_TEMPLATE_TXX
285 #endif
286 
287 #endif

Generated at Sat Feb 2 2013 23:38:54 for Orfeo Toolbox with doxygen 1.8.1.1