18 #ifndef __otbMRFEnergyGaussianClassification_h
19 #define __otbMRFEnergyGaussianClassification_h
43 template<
class TInput1,
class TInput2>
62 void SetNumberOfParameters(
const unsigned int nParameters)
64 Superclass::SetNumberOfParameters(nParameters);
65 this->m_Parameters.SetSize(nParameters);
71 if ((
unsigned int) value2 >= this->GetNumberOfParameters() / 2)
73 itkExceptionMacro(<<
"Number of parameters does not correspond to number of classes");
75 double val1 =
static_cast<double>(value1);
77 double result = vnl_math_sqr(val1 - this->m_Parameters[2 * static_cast<int>(value2)])
78 / (2 * vnl_math_sqr(this->m_Parameters[2 * static_cast<int>(value2) + 1]))
79 + vcl_log(vcl_sqrt(
CONST_2PI) * this->m_Parameters[2 *
static_cast<int>(value2) + 1]);
81 return static_cast<double>(result);