20 #ifndef __otbMRFEnergyFisherClassification_h
21 #define __otbMRFEnergyFisherClassification_h
25 #include <boost/math/special_functions/gamma.hpp>
41 template<
class TInput1,
class TInput2>
59 void SetNumberOfParameters(
const unsigned int nParameters)
61 Superclass::SetNumberOfParameters(nParameters);
62 this->m_Parameters.SetSize(nParameters);
68 if ((
unsigned int)value2 >= this->GetNumberOfParameters()/3)
70 itkExceptionMacro(<<
"Number of parameters does not correspond to number of classes" );
72 double val1 =
static_cast<double>(value1);
73 double mu = this->m_Parameters[3*value2];
74 double l = this->m_Parameters[3*value2+1];
75 double m = this->m_Parameters[3*value2+2];
77 double result = -vcl_log((boost::math::tgamma(l+m)/(boost::math::tgamma(l)*boost::math::tgamma(m)))
78 * (2/(mu)) * (vcl_sqrt(l/m)) *
79 ((vcl_pow((vcl_sqrt(l/m)*(val1/mu)), ((2*l)-1))) /
80 (vcl_pow(1+(vcl_sqrt(l/m)*(val1/mu)*vcl_sqrt(l/m)*(val1/mu)), (l+m)))));