ITK  5.2.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  * 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 itkGaussianOperator_h
19 #define itkGaussianOperator_h
20 
22 #include <cmath>
23 namespace itk
24 {
68 template <typename TPixel, unsigned int VDimension = 2, typename TAllocator = NeighborhoodAllocator<TPixel>>
69 class ITK_TEMPLATE_EXPORT GaussianOperator : public NeighborhoodOperator<TPixel, VDimension, TAllocator>
70 {
71 public:
72 
76 
78 
80  void
81  SetVariance(const double & variance)
82  {
83  m_Variance = variance;
84  }
85 
90  void
91  SetMaximumError(const double & max_error)
92  {
93  if (max_error >= 1 || max_error <= 0)
94  {
95  itkExceptionMacro("Maximum Error Must be in the range [ 0.0 , 1.0 ]");
96  }
97 
98  m_MaximumError = max_error;
99  }
100 
102  double
104  {
105  return m_Variance;
106  }
107 
112  double
114  {
115  return m_MaximumError;
116  }
117 
122  void
123  SetMaximumKernelWidth(unsigned int n)
124  {
125  m_MaximumKernelWidth = n;
126  }
127 
129  unsigned int
131  {
132  return m_MaximumKernelWidth;
133  }
134 
136  void
137  PrintSelf(std::ostream & os, Indent i) const override
138  {
139  os << i << "GaussianOperator { this=" << this << ", m_Variance = " << m_Variance
140  << ", m_MaximumError = " << m_MaximumError << "} " << std::endl;
141  Superclass::PrintSelf(os, i.GetNextIndent());
142  }
144 
145 protected:
147 
148 public:
151  double
152  ModifiedBesselI0(double);
153 
156  double
157  ModifiedBesselI1(double);
158 
161  double
162  ModifiedBesselI(int, double);
163 
164 protected:
167  GenerateCoefficients() override;
168 
170  void
171  Fill(const CoefficientVector & coeff) override
172  {
173  this->FillCenteredDirectional(coeff);
174  }
175 
176 private:
178  double m_Variance{ 1 };
179 
182  double m_MaximumError{ .01 };
183 
187  unsigned int m_MaximumKernelWidth{ 30 };
188 };
189 } // namespace itk
190 
191 #ifndef ITK_MANUAL_INSTANTIATION
192 # include "itkGaussianOperator.hxx"
193 #endif
194 
195 #endif
itk::GaussianOperator::PrintSelf
void PrintSelf(std::ostream &os, Indent i) const override
Definition: itkGaussianOperator.h:137
itk::Indent::GetNextIndent
Indent GetNextIndent() const
itk::GaussianOperator::GetMaximumKernelWidth
unsigned int GetMaximumKernelWidth() const
Definition: itkGaussianOperator.h:130
itk::NeighborhoodOperator
Virtual class that defines a common interface to all neighborhood operator subtypes.
Definition: itkNeighborhoodOperator.h:72
itkNeighborhoodOperator.h
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::GaussianOperator::GetVariance
double GetVariance()
Definition: itkGaussianOperator.h:103
itk::GaussianOperator::SetMaximumError
void SetMaximumError(const double &max_error)
Definition: itkGaussianOperator.h:91
itk::GaussianOperator
A NeighborhoodOperator whose coefficients are a one dimensional, discrete Gaussian kernel.
Definition: itkGaussianOperator.h:69
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::GaussianOperator::GetMaximumError
double GetMaximumError()
Definition: itkGaussianOperator.h:113
itk::GaussianOperator::Fill
void Fill(const CoefficientVector &coeff) override
Definition: itkGaussianOperator.h:171
itk::GaussianOperator< ScalarType, Superclass::Dimension >::CoefficientVector
typename Superclass::CoefficientVector CoefficientVector
Definition: itkGaussianOperator.h:146
itk::GaussianOperator::SetMaximumKernelWidth
void SetMaximumKernelWidth(unsigned int n)
Definition: itkGaussianOperator.h:123
itk::NeighborhoodOperator< ScalarType, VDimension, NeighborhoodAllocator< ScalarType > >::CoefficientVector
std::vector< PixelRealType > CoefficientVector
Definition: itkNeighborhoodOperator.h:148
itk::GaussianOperator::SetVariance
void SetVariance(const double &variance)
Definition: itkGaussianOperator.h:81