ITK  6.0.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
42 enum class InterpolationMode : uint8_t
43 {
44 NearestNeighbourInterpolation,
45 LinearInterpolation
46 };
47};
48// Define how to print enumeration
49extern ITKCommon_EXPORT std::ostream &
51
104template <typename TPixel, unsigned int VDimension = 2, typename TAllocator = NeighborhoodAllocator<TPixel>>
105class ITK_TEMPLATE_EXPORT GaussianDerivativeOperator : public NeighborhoodOperator<TPixel, VDimension, TAllocator>
106{
107public:
108
112
114 itkOverrideGetNameOfClassMacro(GaussianDerivativeOperator);
115
117
121
130 void
132 {
133 m_NormalizeAcrossScale = flag;
134 }
135 bool
137 {
138 return m_NormalizeAcrossScale;
139 }
140 itkBooleanMacro(NormalizeAcrossScale);
146 void
147 SetVariance(const double variance)
148 {
149 m_Variance = variance;
150 }
151 double
153 {
154 return m_Variance;
155 }
159 void
160 SetSpacing(const double spacing)
161 {
162 m_Spacing = spacing;
163 }
164 double
166 {
167 return m_Spacing;
168 }
175 void
176 SetMaximumError(const double maxerror)
177 {
178 constexpr double Min = 0.00001;
179 const double Max = 1.0 - Min;
180
181 m_MaximumError = std::clamp(maxerror, Min, Max);
182 }
183 double
185 {
186 return m_MaximumError;
187 }
188
193 void
194 SetMaximumKernelWidth(unsigned int n)
195 {
196 m_MaximumKernelWidth = n;
197 }
198 itkGetConstMacro(MaximumKernelWidth, unsigned int);
202 void
203 SetOrder(const unsigned int order)
204 {
205 m_Order = order;
206 }
207 unsigned int
208 GetOrder() const
209 {
210 return m_Order;
211 }
214 void
215 PrintSelf(std::ostream & os, Indent indent) const override;
216
217protected:
219 using typename Superclass::CoefficientVector;
220
223 static double
225
228 static double
230
233 static double
234 ModifiedBesselI(int, double);
235
239
241 void
242 Fill(const CoefficientVector & coeff) override
243 {
244 this->FillCenteredDirectional(coeff);
245 }
246
247private:
248 /* Methods for generations of the coefficients for a Gaussian
249 * operator of 0-order respecting the remaining parameters. */
250 CoefficientVector
252
254 bool m_NormalizeAcrossScale{ true };
255
257 double m_Variance{ 1.0 };
258
261 double m_MaximumError{ 0.005 };
262
266 unsigned int m_MaximumKernelWidth{ 30 };
267
269 unsigned int m_Order{ 1 };
270
272 double m_Spacing{ 1.0 };
273};
274
275} // namespace itk
276
277#ifndef ITK_MANUAL_INSTANTIATION
278# include "itkGaussianDerivativeOperator.hxx"
279#endif
280
281#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....
ITKCommon_EXPORT std::ostream & operator<<(std::ostream &out, typename AnatomicalOrientation::CoordinateEnum value)