Orfeo Toolbox  3.16
itkGaussianRadialBasisFunction.txx
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkGaussianRadialBasisFunction.txx,v $
5  Language: C++
6  Date: $Date: 2009-01-24 21:33:49 $
7  Version: $Revision: 1.5 $
8 
9  Copyright (c) Insight Software Consortium. All rights reserved.
10  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 
18 #ifndef __itkGaussianRadialBasisFunction_txx
19 #define __itkGaussianRadialBasisFunction_txx
20 
22 
23 #include <math.h>
24 
25 namespace itk
26 {
27 namespace Statistics
28 {
29 
31 template<class ScalarType>
34 {
35 }
36 
38 template<class ScalarType>
41 {
42 }
43 
45 template<class ScalarType>
46 ScalarType
48 ::Evaluate(const ScalarType& input) const
49 {
50  ScalarType val;
51  ScalarType radius = Superclass::GetRadius();
52  val = vcl_exp(-0.5*vcl_pow(input,2)/vcl_pow(radius,2));
53  return val;
54 }
55 
57 template<class ScalarType>
58 ScalarType
60 ::EvaluateDerivative(const ScalarType& dist,const ArrayType& input,
61  char mode,int element_id) const
62 {
63  ScalarType val = 0;
64  ScalarType radius=Superclass::GetRadius();
65  ArrayType center = Superclass::GetCenter();
66  if(mode=='u') //w.r.t centers
67  {
68  ScalarType temp1= vcl_pow(radius,2);
69  val=Evaluate(dist)
70  *(input.GetElement(element_id)-center.GetElement(element_id))/temp1;
71  }
72  else if(mode=='s') // w.r.t radius
73  {
74  val=Evaluate(dist)*vcl_pow(dist,2)/vcl_pow(radius,3);
75  }
76  return val;
77 }
78 
80 template<class ScalarType>
81 void
83 ::PrintSelf( std::ostream& os, Indent indent ) const
84 {
85  os << indent << "GaussianRadialBasisFunction(" << this << ")" << std::endl;
86  Superclass::PrintSelf( os, indent );
87 }
88 
89 } // end namespace Statistics
90 } // end namespace itk
91 
92 #endif

Generated at Sat Feb 2 2013 23:38:57 for Orfeo Toolbox with doxygen 1.8.1.1