ITK  6.0.0
Insight Toolkit
itkGaussianOperator.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 itkGaussianOperator_h
19#define itkGaussianOperator_h
20
22#include <cmath>
23namespace itk
24{
68template <typename TPixel, unsigned int VDimension = 2, typename TAllocator = NeighborhoodAllocator<TPixel>>
69class ITK_TEMPLATE_EXPORT GaussianOperator : public NeighborhoodOperator<TPixel, VDimension, TAllocator>
70{
71public:
72
76
78 itkOverrideGetNameOfClassMacro(GaussianOperator);
79
81 void
82 SetVariance(const double variance)
83 {
84 m_Variance = variance;
85 }
86
91 void
92 SetMaximumError(const double max_error)
93 {
94 if (max_error >= 1 || max_error <= 0)
95 {
96 itkExceptionMacro("Maximum Error Must be in the range [ 0.0 , 1.0 ]");
97 }
98
99 m_MaximumError = max_error;
100 }
101
103 double
105 {
106 return m_Variance;
107 }
108
113 double
115 {
116 return m_MaximumError;
117 }
118
123 void
124 SetMaximumKernelWidth(unsigned int n)
125 {
126 m_MaximumKernelWidth = n;
127 }
128
130 unsigned int
132 {
133 return m_MaximumKernelWidth;
134 }
135
136 void
137 PrintSelf(std::ostream & os, Indent indent) const override
138 {
139 Superclass::PrintSelf(os, indent);
140
141 os << indent << "Variance: " << m_Variance << std::endl;
142 os << indent << "MaximumError: " << m_MaximumError << std::endl;
143 os << indent << "MaximumKernelWidth: " << m_MaximumKernelWidth << std::endl;
144 }
145
149 bool
150 GetDebug() const
151 {
152 return m_Debug;
153 }
154
156 void
157 DebugOn() const
158 {
159 m_Debug = true;
160 }
161
163 void
164 DebugOff() const
165 {
166 m_Debug = false;
167 }
168
170 void
171 SetDebug(bool debugFlag) const
172 {
173 m_Debug = debugFlag;
174 }
175
176public:
179 double
181
184 double
186
189 double
190 ModifiedBesselI(int, double);
191
192protected:
194 using typename Superclass::CoefficientVector;
195
199
201 void
202 Fill(const CoefficientVector & coeff) override
203 {
204 this->FillCenteredDirectional(coeff);
205 }
206
207private:
209 double m_Variance{ 1 };
210
213 double m_MaximumError{ .01 };
214
218 unsigned int m_MaximumKernelWidth{ 30 };
219
221 mutable bool m_Debug{ false };
222};
223} // namespace itk
224
225#ifndef ITK_MANUAL_INSTANTIATION
226# include "itkGaussianOperator.hxx"
227#endif
228
229#endif
A NeighborhoodOperator whose coefficients are a one dimensional, discrete Gaussian kernel.
double ModifiedBesselI1(double)
double ModifiedBesselI0(double)
void SetMaximumError(const double max_error)
void SetMaximumKernelWidth(unsigned int n)
double ModifiedBesselI(int, double)
void Fill(const CoefficientVector &coeff) override
void SetVariance(const double variance)
void PrintSelf(std::ostream &os, Indent indent) const override
unsigned int GetMaximumKernelWidth() const
void SetDebug(bool debugFlag) const
typename std::vector< PixelRealType > CoefficientVector
CoefficientVector GenerateCoefficients() override
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....