ITK  5.0.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 #include <algorithm>
25 
26 namespace itk
27 {
77 template< typename TPixel, unsigned int VDimension = 2,
78  typename TAllocator = NeighborhoodAllocator< TPixel > >
79 class ITK_TEMPLATE_EXPORT GaussianDerivativeOperator :
80  public NeighborhoodOperator< TPixel, VDimension, TAllocator >
81 {
82 public:
83 
87 
91 
93  GaussianDerivativeOperator() = default;
94 
96  GaussianDerivativeOperator(const Self & other);
97 
99  Self & operator=(const Self & other);
100 
101 
110  void SetNormalizeAcrossScale(bool flag) { m_NormalizeAcrossScale = flag; }
111  bool GetNormalizeAcrossScale() const { return m_NormalizeAcrossScale; }
112  itkBooleanMacro(NormalizeAcrossScale);
114 
118  void SetVariance(const double variance) { m_Variance = variance; }
119  double GetVariance() const { return m_Variance; }
121 
123  void SetSpacing(const double spacing) { m_Spacing = spacing; }
124  double GetSpacing() const { return m_Spacing; }
126 
131  void SetMaximumError(const double maxerror)
132  {
133  constexpr double Min = 0.00001;
134  const double Max = 1.0 - Min;
135 
136  m_MaximumError = std::max( Min, std::min( Max, maxerror ) );
137  }
138  double GetMaximumError() { return m_MaximumError; }
139 
144  void SetMaximumKernelWidth(unsigned int n)
145  {
146  m_MaximumKernelWidth = n;
147  }
148 
150  void SetOrder(const unsigned int order) { m_Order = order;}
151  unsigned int GetOrder() const { return m_Order; }
153 
155  void PrintSelf(std::ostream & os, Indent i) const override;
156 
157 protected:
158 
160 
163  static double ModifiedBesselI0(double);
164 
167  static double ModifiedBesselI1(double);
168 
171  static double ModifiedBesselI(int, double);
172 
174  CoefficientVector GenerateCoefficients() override;
175 
177  void Fill(const CoefficientVector & coeff) override
178  { this->FillCenteredDirectional(coeff); }
179 
180 private:
181 
182  /* methods for generations of the coeeficients for a gaussian
183  * operator of 0-order respecting the remaining parameters */
184  CoefficientVector GenerateGaussianCoefficients() const;
185 
187  const char * GetNameOfClass() const override
188  {
189  return "itkGaussianDerivativeOperator";
190  }
191 
193  bool m_NormalizeAcrossScale{true};
194 
196  double m_Variance{1.0};
197 
200  double m_MaximumError{0.005};
201 
205  unsigned int m_MaximumKernelWidth{30};
206 
208  unsigned int m_Order{1};
209 
211  double m_Spacing{1.0};
212 };
213 } // namespace itk
214 
215 #ifndef ITK_MANUAL_INSTANTIATION
216 #include "itkGaussianDerivativeOperator.hxx"
217 #endif
218 
219 #endif
const char * GetNameOfClass() const override
A NeighborhoodOperator whose coefficients are a one dimensional, discrete Gaussian kernel...
A NeighborhoodOperator for taking an n-th order derivative at a pixel.
typename Superclass::CoefficientVector CoefficientVector
void Fill(const CoefficientVector &coeff) override
Virtual class that defines a common interface to all neighborhood operator subtypes.
A NeighborhoodOperator whose coefficients are a one dimensional, discrete derivative Gaussian kernel...
Control indentation during Print() invocation.
Definition: itkIndent.h:49
void SetOrder(const unsigned int order)
std::vector< PixelRealType > CoefficientVector