ITK  5.3.0
Insight Toolkit
itkGaussianDerivativeOperator.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 {
28 
35 {
36 public:
37 
44  {
47  };
48 };
49 // Define how to print enumeration
50 extern ITKCommon_EXPORT std::ostream &
52 
105 template <typename TPixel, unsigned int VDimension = 2, typename TAllocator = NeighborhoodAllocator<TPixel>>
106 class ITK_TEMPLATE_EXPORT GaussianDerivativeOperator : public NeighborhoodOperator<TPixel, VDimension, TAllocator>
107 {
108 public:
109 
113 
116 
118 
122 
131  void
133  {
134  m_NormalizeAcrossScale = flag;
135  }
136  bool
138  {
139  return m_NormalizeAcrossScale;
140  }
141  itkBooleanMacro(NormalizeAcrossScale);
143 
147  void
148  SetVariance(const double variance)
149  {
150  m_Variance = variance;
151  }
152  double
153  GetVariance() const
154  {
155  return m_Variance;
156  }
158 
160  void
161  SetSpacing(const double spacing)
162  {
163  m_Spacing = spacing;
164  }
165  double
166  GetSpacing() const
167  {
168  return m_Spacing;
169  }
171 
176  void
177  SetMaximumError(const double maxerror)
178  {
179  constexpr double Min = 0.00001;
180  const double Max = 1.0 - Min;
181 
182  m_MaximumError = std::max(Min, std::min(Max, maxerror));
183  }
184  double
186  {
187  return m_MaximumError;
188  }
189 
194  void
195  SetMaximumKernelWidth(unsigned int n)
196  {
197  m_MaximumKernelWidth = n;
198  }
199  itkGetConstMacro(MaximumKernelWidth, unsigned int);
201 
203  void
204  SetOrder(const unsigned int order)
205  {
206  m_Order = order;
207  }
208  unsigned int
209  GetOrder() const
210  {
211  return m_Order;
212  }
214 
215  void
216  PrintSelf(std::ostream & os, Indent indent) const override;
217 
218 protected:
220  using typename Superclass::CoefficientVector;
221 
224  static double
225  ModifiedBesselI0(double);
226 
229  static double
230  ModifiedBesselI1(double);
231 
234  static double
235  ModifiedBesselI(int, double);
236 
238  CoefficientVector
239  GenerateCoefficients() override;
240 
242  void
243  Fill(const CoefficientVector & coeff) override
244  {
245  this->FillCenteredDirectional(coeff);
246  }
247 
248 private:
249  /* Methods for generations of the coefficients for a Gaussian
250  * operator of 0-order respecting the remaining parameters. */
251  CoefficientVector
252  GenerateGaussianCoefficients() const;
253 
255  bool m_NormalizeAcrossScale{ true };
256 
258  double m_Variance{ 1.0 };
259 
262  double m_MaximumError{ 0.005 };
263 
267  unsigned int m_MaximumKernelWidth{ 30 };
268 
270  unsigned int m_Order{ 1 };
271 
273  double m_Spacing{ 1.0 };
274 };
275 
276 } // namespace itk
277 
278 #ifndef ITK_MANUAL_INSTANTIATION
279 # include "itkGaussianDerivativeOperator.hxx"
280 #endif
281 
282 #endif
itk::GaussianDerivativeOperator::SetOrder
void SetOrder(const unsigned int order)
Definition: itkGaussianDerivativeOperator.h:204
itk::GaussianDerivativeOperatorEnums::InterpolationMode::LinearInterpolation
itk::GaussianDerivativeOperator::SetMaximumKernelWidth
void SetMaximumKernelWidth(unsigned int n)
Definition: itkGaussianDerivativeOperator.h:195
itk::operator<<
std::ostream & operator<<(std::ostream &os, const Array< TValue > &arr)
Definition: itkArray.h:216
itk::NeighborhoodOperator
Virtual class that defines a common interface to all neighborhood operator subtypes.
Definition: itkNeighborhoodOperator.h:72
InterpolationMode
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::GaussianDerivativeOperatorEnums::InterpolationMode
InterpolationMode
Definition: itkGaussianDerivativeOperator.h:43
itk::NeighborhoodOperator::CoefficientVector
typename std::vector< PixelRealType > CoefficientVector
Definition: itkNeighborhoodOperator.h:147
itk::GaussianDerivativeOperator::GetNormalizeAcrossScale
bool GetNormalizeAcrossScale() const
Definition: itkGaussianDerivativeOperator.h:137
itk::GaussianDerivativeOperator::SetVariance
void SetVariance(const double variance)
Definition: itkGaussianDerivativeOperator.h:148
itk::GaussianDerivativeOperator::SetMaximumError
void SetMaximumError(const double maxerror)
Definition: itkGaussianDerivativeOperator.h:177
itk::GaussianOperator
A NeighborhoodOperator whose coefficients are a one dimensional, discrete Gaussian kernel.
Definition: itkGaussianOperator.h:69
itk::GaussianDerivativeOperator::SetNormalizeAcrossScale
void SetNormalizeAcrossScale(bool flag)
Definition: itkGaussianDerivativeOperator.h:132
itk::GaussianDerivativeOperatorEnums
GaussianDerivativeOperator class enum classes.
Definition: itkGaussianDerivativeOperator.h:34
itk::uint8_t
std::uint8_t uint8_t
Definition: itkIntTypes.h:29
itk::GaussianDerivativeOperator::GetOrder
unsigned int GetOrder() const
Definition: itkGaussianDerivativeOperator.h:209
itk::GaussianDerivativeOperator::GetSpacing
double GetSpacing() const
Definition: itkGaussianDerivativeOperator.h:166
itk::GaussianDerivativeOperator::Fill
void Fill(const CoefficientVector &coeff) override
Definition: itkGaussianDerivativeOperator.h:243
itk::GaussianDerivativeOperator::GetVariance
double GetVariance() const
Definition: itkGaussianDerivativeOperator.h:153
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::DerivativeOperator
A NeighborhoodOperator for taking an n-th order derivative at a pixel.
Definition: itkDerivativeOperator.h:69
itk::GaussianDerivativeOperatorEnums::InterpolationMode::NearestNeighbourInterpolation
itk::GaussianDerivativeOperator::SetSpacing
void SetSpacing(const double spacing)
Definition: itkGaussianDerivativeOperator.h:161
itkDerivativeOperator.h
itkGaussianOperator.h
itk::GaussianDerivativeOperator::GetMaximumError
double GetMaximumError()
Definition: itkGaussianDerivativeOperator.h:185
itk::GaussianDerivativeOperator
A NeighborhoodOperator whose coefficients are a one dimensional, discrete derivative Gaussian kernel.
Definition: itkGaussianDerivativeOperator.h:106