ITK  4.3.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 
178 private:
179 
180  /* methods for generations of the coeeficients for a gaussian
181  * operator of 0-order respecting the remaining parameters */
182  CoefficientVector GenerateGaussianCoefficients() const;
183 
185  const char * GetNameOfClass() const
186  {
187  return "itkGaussianDerivativeOperator";
188  }
189 
192 
194  double m_Variance;
195 
199 
203  unsigned int m_MaximumKernelWidth;
204 
206  unsigned int m_Order;
207 
209  double m_Spacing;
210 };
211 } // namespace itk
212 
213 #ifndef ITK_MANUAL_INSTANTIATION
214 #include "itkGaussianDerivativeOperator.hxx"
215 #endif
216 
217 #endif
218