ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkGaussianOperator.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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 {
65 template< typename TPixel, unsigned int VDimension = 2,
66  typename TAllocator = NeighborhoodAllocator< TPixel > >
67 class ITK_TEMPLATE_EXPORT GaussianOperator:
68  public NeighborhoodOperator< TPixel, VDimension, TAllocator >
69 {
70 public:
71 
75 
77 
80 
82  GaussianOperator(const Self & other):
83  NeighborhoodOperator< TPixel, VDimension, TAllocator >(other)
84  {
85  m_Variance = other.m_Variance;
86  m_MaximumError = other.m_MaximumError;
87  m_MaximumKernelWidth = other.m_MaximumKernelWidth;
88  }
90 
92  Self & operator=(const Self & other)
93  {
94  if(this != &other)
95  {
96  Superclass::operator=(other);
97  m_Variance = other.m_Variance;
98  m_MaximumError = other.m_MaximumError;
99  m_MaximumKernelWidth = other.m_MaximumKernelWidth;
100  }
101  return *this;
102  }
104 
106  void SetVariance(const double & variance)
107  {
108  m_Variance = variance;
109  }
110 
115  void SetMaximumError(const double & max_error)
116  {
117  if ( max_error >= 1 || max_error <= 0 )
118  {
119  itkExceptionMacro("Maximum Error Must be in the range [ 0.0 , 1.0 ]");
120  }
121 
122  m_MaximumError = max_error;
123  }
124 
126  double GetVariance()
127  { return m_Variance; }
128 
134  { return m_MaximumError; }
135 
140  void SetMaximumKernelWidth(unsigned int n)
141  { m_MaximumKernelWidth = n; }
142 
144  unsigned int GetMaximumKernelWidth() const
145  { return m_MaximumKernelWidth; }
146 
148  void PrintSelf(std::ostream & os, Indent i) const override
149  {
150  os << i << "GaussianOperator { this=" << this
151  << ", m_Variance = " << m_Variance
152  << ", m_MaximumError = " << m_MaximumError
153  << "} " << std::endl;
154  Superclass::PrintSelf( os, i.GetNextIndent() );
155  }
157 
158 protected:
160 
161 public:
164  double ModifiedBesselI0(double);
165 
168  double ModifiedBesselI1(double);
169 
172  double ModifiedBesselI(int, double);
173 
174 protected:
176  CoefficientVector GenerateCoefficients() override;
177 
179  void Fill(const CoefficientVector & coeff) override
180  { this->FillCenteredDirectional(coeff); }
181 
182 private:
184  double m_Variance{1};
185 
188  double m_MaximumError{.01};
189 
193  unsigned int m_MaximumKernelWidth{30};
194 
195 };
196 } // namespace itk
197 
198 #ifndef ITK_MANUAL_INSTANTIATION
199 #include "itkGaussianOperator.hxx"
200 #endif
201 
202 #endif
A NeighborhoodOperator whose coefficients are a one dimensional, discrete Gaussian kernel...
void SetVariance(const double &variance)
void SetMaximumKernelWidth(unsigned int n)
void Fill(const CoefficientVector &coeff) override
Virtual class that defines a common interface to all neighborhood operator subtypes.
void PrintSelf(std::ostream &os, Indent i) const override
typename Superclass::CoefficientVector CoefficientVector
Self & operator=(const Self &other)
GaussianOperator(const Self &other)
Control indentation during Print() invocation.
Definition: itkIndent.h:49
unsigned int GetMaximumKernelWidth() const
void SetMaximumError(const double &max_error)
Indent GetNextIndent()