ITK  5.2.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 
115 
119 
128  void
130  {
131  m_NormalizeAcrossScale = flag;
132  }
133  bool
135  {
136  return m_NormalizeAcrossScale;
137  }
138  itkBooleanMacro(NormalizeAcrossScale);
140 
144  void
145  SetVariance(const double variance)
146  {
147  m_Variance = variance;
148  }
149  double
150  GetVariance() const
151  {
152  return m_Variance;
153  }
155 
157  void
158  SetSpacing(const double spacing)
159  {
160  m_Spacing = spacing;
161  }
162  double
163  GetSpacing() const
164  {
165  return m_Spacing;
166  }
168 
173  void
174  SetMaximumError(const double maxerror)
175  {
176  constexpr double Min = 0.00001;
177  const double Max = 1.0 - Min;
178 
179  m_MaximumError = std::max(Min, std::min(Max, maxerror));
180  }
181  double
183  {
184  return m_MaximumError;
185  }
186 
191  void
192  SetMaximumKernelWidth(unsigned int n)
193  {
194  m_MaximumKernelWidth = n;
195  }
196 
198  void
199  SetOrder(const unsigned int order)
200  {
201  m_Order = order;
202  }
203  unsigned int
204  GetOrder() const
205  {
206  return m_Order;
207  }
209 
211  void
212  PrintSelf(std::ostream & os, Indent i) const override;
213 
214 protected:
216 
219  static double
220  ModifiedBesselI0(double);
221 
224  static double
225  ModifiedBesselI1(double);
226 
229  static double
230  ModifiedBesselI(int, double);
231 
234  GenerateCoefficients() override;
235 
237  void
238  Fill(const CoefficientVector & coeff) override
239  {
240  this->FillCenteredDirectional(coeff);
241  }
242 
243 private:
244  /* methods for generations of the coefficients for a gaussian
245  * operator of 0-order respecting the remaining parameters */
246  CoefficientVector
247  GenerateGaussianCoefficients() const;
248 
250  const char *
251  GetNameOfClass() const override
252  {
253  return "itkGaussianDerivativeOperator";
254  }
255 
257  bool m_NormalizeAcrossScale{ true };
258 
260  double m_Variance{ 1.0 };
261 
264  double m_MaximumError{ 0.005 };
265 
269  unsigned int m_MaximumKernelWidth{ 30 };
270 
272  unsigned int m_Order{ 1 };
273 
275  double m_Spacing{ 1.0 };
276 };
277 
278 } // namespace itk
279 
280 #ifndef ITK_MANUAL_INSTANTIATION
281 # include "itkGaussianDerivativeOperator.hxx"
282 #endif
283 
284 #endif
itk::GaussianDerivativeOperator::SetOrder
void SetOrder(const unsigned int order)
Definition: itkGaussianDerivativeOperator.h:199
itk::uint8_t
::uint8_t uint8_t
Definition: itkIntTypes.h:29
itk::GaussianDerivativeOperatorEnums::InterpolationMode::LinearInterpolation
itk::GaussianDerivativeOperator::SetMaximumKernelWidth
void SetMaximumKernelWidth(unsigned int n)
Definition: itkGaussianDerivativeOperator.h:192
itk::operator<<
std::ostream & operator<<(std::ostream &os, const Array< TValue > &arr)
Definition: itkArray.h:218
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::GaussianDerivativeOperator::GetNormalizeAcrossScale
bool GetNormalizeAcrossScale() const
Definition: itkGaussianDerivativeOperator.h:134
itk::GaussianDerivativeOperator::CoefficientVector
typename Superclass::CoefficientVector CoefficientVector
Definition: itkGaussianDerivativeOperator.h:215
itk::GaussianDerivativeOperator::GetNameOfClass
const char * GetNameOfClass() const override
Definition: itkGaussianDerivativeOperator.h:251
itk::GaussianDerivativeOperator::SetVariance
void SetVariance(const double variance)
Definition: itkGaussianDerivativeOperator.h:145
itk::GaussianDerivativeOperator::SetMaximumError
void SetMaximumError(const double maxerror)
Definition: itkGaussianDerivativeOperator.h:174
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:129
itk::GaussianDerivativeOperatorEnums
GaussianDerivativeOperator class enum classes.
Definition: itkGaussianDerivativeOperator.h:34
itk::GaussianDerivativeOperator::GetOrder
unsigned int GetOrder() const
Definition: itkGaussianDerivativeOperator.h:204
itk::GaussianDerivativeOperator::GetSpacing
double GetSpacing() const
Definition: itkGaussianDerivativeOperator.h:163
itk::GaussianDerivativeOperator::Fill
void Fill(const CoefficientVector &coeff) override
Definition: itkGaussianDerivativeOperator.h:238
itk::GaussianDerivativeOperator::GetVariance
double GetVariance() const
Definition: itkGaussianDerivativeOperator.h:150
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:158
itkDerivativeOperator.h
itkGaussianOperator.h
itk::GaussianDerivativeOperator::GetMaximumError
double GetMaximumError()
Definition: itkGaussianDerivativeOperator.h:182
itk::GaussianDerivativeOperator
A NeighborhoodOperator whose coefficients are a one dimensional, discrete derivative Gaussian kernel.
Definition: itkGaussianDerivativeOperator.h:106
itk::NeighborhoodOperator::CoefficientVector
std::vector< PixelRealType > CoefficientVector
Definition: itkNeighborhoodOperator.h:148