21 #ifndef otbMRFEnergyGaussianClassification_h
22 #define otbMRFEnergyGaussianClassification_h
26 #include "vcl_legacy_aliases.h"
49 template <
class TInput1,
class TInput2>
70 Superclass::SetNumberOfParameters(nParameters);
71 this->m_Parameters.SetSize(nParameters);
77 if ((
unsigned int)value2 >= this->GetNumberOfParameters() / 2)
79 itkExceptionMacro(<<
"Number of parameters does not correspond to number of classes");
81 double val1 =
static_cast<double>(value1);
84 vnl_math_sqr(val1 - this->m_Parameters[2 *
static_cast<int>(value2)]) / (2 * vnl_math_sqr(this->m_Parameters[2 *
static_cast<int>(value2) + 1])) +
85 std::log(std::sqrt(
CONST_2PI) * this->m_Parameters[2 *
static_cast<int>(value2) + 1]);
87 return static_cast<double>(result);
This is the implementation of the Gaussian model for Markov classification.
void SetNumberOfParameters(const unsigned int nParameters) override
itk::SmartPointer< Self > Pointer
TInput2 LabelledImageType
itk::SmartPointer< const Self > ConstPointer
MRFEnergyGaussianClassification()
MRFEnergy< TInput1, TInput2 > Superclass
MRFEnergyGaussianClassification Self
InputImageType::PixelType InputImagePixelType
LabelledImageType::PixelType LabelledImagePixelType
itk::Array< double > ParametersType
double GetSingleValue(const InputImagePixelType &value1, const LabelledImagePixelType &value2) override
~MRFEnergyGaussianClassification() override
This is the base class for energy function used in the MRF framework.
InputImageType::PixelType InputImagePixelType
LabelledImageType::PixelType LabelledImagePixelType
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
constexpr double CONST_2PI