ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkGaussianDerivativeOperator.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkGaussianDerivativeOperator_h
19 #define __itkGaussianDerivativeOperator_h
20 
21 #include "itkGaussianOperator.h"
22 #include "itkDerivativeOperator.h"
23 
24 namespace itk
25 {
75 template< class TPixel, unsigned int VDimension = 2,
76  class TAllocator = NeighborhoodAllocator< TPixel > >
77 class ITK_EXPORT GaussianDerivativeOperator :
78  public NeighborhoodOperator< TPixel, VDimension, TAllocator >
79 {
80 public:
81 
85 
89 
92 
94  GaussianDerivativeOperator(const Self & other);
95 
97  Self & operator=(const Self & other);
98 
99 
108  void SetNormalizeAcrossScale(bool flag) { m_NormalizeAcrossScale = flag; }
109  bool GetNormalizeAcrossScale() const { return m_NormalizeAcrossScale; }
110  itkBooleanMacro(NormalizeAcrossScale);
112 
116  void SetVariance(const double variance) { m_Variance = variance; }
117  double GetVariance() const { return m_Variance; }
119 
121  void SetSpacing(const double spacing) { m_Spacing = spacing; }
122  double GetSpacing() const { return m_Spacing; }
124 
129  void SetMaximumError(const double maxerror)
130  {
131  const double Min = 0.00001;
132  const double Max = 1.0 - Min;
133 
134  m_MaximumError = std::max( Min, std::min( Max, maxerror ) );
135  }
136  double GetMaximumError() { return m_MaximumError; }
137 
142  void SetMaximumKernelWidth(unsigned int n)
143  {
144  m_MaximumKernelWidth = n;
145  }
146 
148  void SetOrder(const unsigned int order) { m_Order = order;}
149  unsigned int GetOrder() const { return m_Order; }
151 
153  virtual void PrintSelf(std::ostream & os, Indent i) const;
154 
155 protected:
156 
157  typedef typename Superclass::CoefficientVector CoefficientVector;
158 
161  static double ModifiedBesselI0(double);
162 
165  static double ModifiedBesselI1(double);
166 
169  static double ModifiedBesselI(int, double);
170 
172  CoefficientVector GenerateCoefficients();
173 
175  void Fill(const CoefficientVector & coeff)
176  { this->FillCenteredDirectional(coeff); }
177 private:
178 
179  /* methods for generations of the coeeficients for a gaussian
180  * operator of 0-order respecting the remaining parameters */
181  CoefficientVector GenerateGaussianCoefficients() const;
182 
184  const char * GetNameOfClass() const
185  {
186  return "itkGaussianDerivativeOperator";
187  }
188 
191 
193  double m_Variance;
194 
198 
202  unsigned int m_MaximumKernelWidth;
203 
205  unsigned int m_Order;
206 
208  double m_Spacing;
209 };
210 } // namespace itk
211 
212 #if ITK_TEMPLATE_TXX
213 #include "itkGaussianDerivativeOperator.hxx"
214 #endif
215 
216 #endif
217