ITK  4.4.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< class TPixel, unsigned int VDimension = 2,
66  class TAllocator = NeighborhoodAllocator< TPixel > >
67 class ITK_EXPORT GaussianOperator:
68  public NeighborhoodOperator< TPixel, VDimension, TAllocator >
69 {
70 public:
71 
75 
77  GaussianOperator():m_Variance(1), m_MaximumError(.01), m_MaximumKernelWidth(30) {}
78 
80  GaussianOperator(const Self & other):
81  NeighborhoodOperator< TPixel, VDimension, TAllocator >(other)
82  {
83  m_Variance = other.m_Variance;
84  m_MaximumError = other.m_MaximumError;
85  m_MaximumKernelWidth = other.m_MaximumKernelWidth;
86  }
88 
90  Self & operator=(const Self & other)
91  {
92  if(this != &other)
93  {
94  Superclass::operator=(other);
95  m_Variance = other.m_Variance;
96  m_MaximumError = other.m_MaximumError;
97  m_MaximumKernelWidth = other.m_MaximumKernelWidth;
98  }
99  return *this;
100  }
102 
104  void SetVariance(const double & variance)
105  {
106  m_Variance = variance;
107  }
108 
113  void SetMaximumError(const double & max_error)
114  {
115  if ( max_error >= 1 || max_error <= 0 )
116  {
117  itkExceptionMacro("Maximum Error Must be in the range [ 0.0 , 1.0 ]");
118  }
119 
120  m_MaximumError = max_error;
121  }
122 
124  double GetVariance()
125  { return m_Variance; }
126 
131  double GetMaximumError()
132  { return m_MaximumError; }
133 
138  void SetMaximumKernelWidth(unsigned int n)
139  { m_MaximumKernelWidth = n; }
140 
142  unsigned int GetMaximumKernelWidth() const
143  { return m_MaximumKernelWidth; }
144 
146  virtual void PrintSelf(std::ostream & os, Indent i) const
147  {
148  os << i << "GaussianOperator { this=" << this
149  << ", m_Variance = " << m_Variance
150  << ", m_MaximumError = " << m_MaximumError
151  << "} " << std::endl;
152  Superclass::PrintSelf( os, i.GetNextIndent() );
153  }
155 
156 protected:
158 
159 public:
162  double ModifiedBesselI0(double);
163 
166  double ModifiedBesselI1(double);
167 
170  double ModifiedBesselI(int, double);
171 
172 protected:
174  CoefficientVector GenerateCoefficients();
175 
177  void Fill(const CoefficientVector & coeff)
178  { this->FillCenteredDirectional(coeff); }
179 
180 private:
182  double m_Variance;
183 
187 
191  unsigned int m_MaximumKernelWidth;
192 
194  const char * GetNameOfClass()
195  { return "itkGaussianOperator"; }
196 };
197 } // namespace itk
198 
199 #ifndef ITK_MANUAL_INSTANTIATION
200 #include "itkGaussianOperator.hxx"
201 #endif
202 
203 #endif
204