ITK  4.6.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 > >
68  public NeighborhoodOperator< TPixel, VDimension, TAllocator >
69 {
70 public:
71 
75 
78 
80  GaussianOperator(const Self & other):
81  NeighborhoodOperator< TPixel, VDimension, TAllocator >(other)
82  {
83  m_Variance = other.m_Variance;
86  }
88 
90  Self & operator=(const Self & other)
91  {
92  if(this != &other)
93  {
94  Superclass::operator=(other);
95  m_Variance = other.m_Variance;
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 
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;
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:
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
A NeighborhoodOperator whose coefficients are a one dimensional, discrete Gaussian kernel...
void Fill(const CoefficientVector &coeff)
void SetVariance(const double &variance)
void SetMaximumKernelWidth(unsigned int n)
virtual void PrintSelf(std::ostream &os, Indent i) const
Superclass::CoefficientVector CoefficientVector
double ModifiedBesselI(int, double)
Virtual class that defines a common interface to all neighborhood operator subtypes.
virtual void PrintSelf(std::ostream &os, Indent i) const
NeighborhoodOperator< TPixel, VDimension, TAllocator > Superclass
double ModifiedBesselI0(double)
virtual void FillCenteredDirectional(const CoefficientVector &)
Self & operator=(const Self &other)
GaussianOperator(const Self &other)
Self & operator=(const Self &orig)
double ModifiedBesselI1(double)
Control indentation during Print() invocation.
Definition: itkIndent.h:49
CoefficientVector GenerateCoefficients()
unsigned int GetMaximumKernelWidth() const
void SetMaximumError(const double &max_error)
Indent GetNextIndent()