ITK  5.4.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 * https://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"
23
24#include <algorithm>
25
26namespace itk
27{
28
35{
36public:
37
43 enum class InterpolationMode : uint8_t
44 {
45 NearestNeighbourInterpolation,
46 LinearInterpolation
47 };
48};
49// Define how to print enumeration
50extern ITKCommon_EXPORT std::ostream &
52
105template <typename TPixel, unsigned int VDimension = 2, typename TAllocator = NeighborhoodAllocator<TPixel>>
106class ITK_TEMPLATE_EXPORT GaussianDerivativeOperator : public NeighborhoodOperator<TPixel, VDimension, TAllocator>
107{
108public:
109
113
115 itkOverrideGetNameOfClassMacro(GaussianDerivativeOperator);
116
118
122
131 void
133 {
134 m_NormalizeAcrossScale = flag;
135 }
136 bool
138 {
139 return m_NormalizeAcrossScale;
140 }
141 itkBooleanMacro(NormalizeAcrossScale);
147 void
148 SetVariance(const double variance)
149 {
150 m_Variance = variance;
151 }
152 double
154 {
155 return m_Variance;
156 }
160 void
161 SetSpacing(const double spacing)
162 {
163 m_Spacing = spacing;
164 }
165 double
167 {
168 return m_Spacing;
169 }
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::clamp(maxerror, Min, Max);
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);
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 }
215 void
216 PrintSelf(std::ostream & os, Indent indent) const override;
217
218protected:
220 using typename Superclass::CoefficientVector;
221
224 static double
226
229 static double
231
234 static double
235 ModifiedBesselI(int, double);
236
240
242 void
243 Fill(const CoefficientVector & coeff) override
244 {
245 this->FillCenteredDirectional(coeff);
246 }
247
248private:
249 /* Methods for generations of the coefficients for a Gaussian
250 * operator of 0-order respecting the remaining parameters. */
251 CoefficientVector
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
A NeighborhoodOperator for taking an n-th order derivative at a pixel.
GaussianDerivativeOperator class enum classes.
A NeighborhoodOperator whose coefficients are a one dimensional, discrete derivative Gaussian kernel.
CoefficientVector GenerateCoefficients() override
static double ModifiedBesselI0(double)
static double ModifiedBesselI(int, double)
CoefficientVector GenerateGaussianCoefficients() const
void PrintSelf(std::ostream &os, Indent indent) const override
void Fill(const CoefficientVector &coeff) override
typename std::vector< PixelRealType > CoefficientVector
void SetOrder(const unsigned int order)
static double ModifiedBesselI1(double)
A NeighborhoodOperator whose coefficients are a one dimensional, discrete Gaussian kernel.
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Virtual class that defines a common interface to all neighborhood operator subtypes.
typename std::vector< PixelRealType > CoefficientVector
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
std::ostream & operator<<(std::ostream &os, const Array< TValue > &arr)
Definition: itkArray.h:216