ITK  4.3.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  Superclass::operator=(other);
93  m_Variance = other.m_Variance;
94  m_MaximumError = other.m_MaximumError;
95  m_MaximumKernelWidth = other.m_MaximumKernelWidth;
96  return *this;
97  }
99 
101  void SetVariance(const double & variance)
102  {
103  m_Variance = variance;
104  }
105 
110  void SetMaximumError(const double & max_error)
111  {
112  if ( max_error >= 1 || max_error <= 0 )
113  {
114  itkExceptionMacro("Maximum Error Must be in the range [ 0.0 , 1.0 ]");
115  }
116 
117  m_MaximumError = max_error;
118  }
119 
121  double GetVariance()
122  { return m_Variance; }
123 
128  double GetMaximumError()
129  { return m_MaximumError; }
130 
135  void SetMaximumKernelWidth(unsigned int n)
136  { m_MaximumKernelWidth = n; }
137 
139  unsigned int GetMaximumKernelWidth() const
140  { return m_MaximumKernelWidth; }
141 
143  virtual void PrintSelf(std::ostream & os, Indent i) const
144  {
145  os << i << "GaussianOperator { this=" << this
146  << ", m_Variance = " << m_Variance
147  << ", m_MaximumError = " << m_MaximumError
148  << "} " << std::endl;
149  Superclass::PrintSelf( os, i.GetNextIndent() );
150  }
152 
153 protected:
155 
156 public:
159  double ModifiedBesselI0(double);
160 
163  double ModifiedBesselI1(double);
164 
167  double ModifiedBesselI(int, double);
168 
169 protected:
171  CoefficientVector GenerateCoefficients();
172 
174  void Fill(const CoefficientVector & coeff)
175  { this->FillCenteredDirectional(coeff); }
176 
177 private:
179  double m_Variance;
180 
184 
188  unsigned int m_MaximumKernelWidth;
189 
191  const char * GetNameOfClass()
192  { return "itkGaussianOperator"; }
193 };
194 } // namespace itk
195 
196 #ifndef ITK_MANUAL_INSTANTIATION
197 #include "itkGaussianOperator.hxx"
198 #endif
199 
200 #endif
201