21 #ifndef otbMRFSamplerRandom_h
22 #define otbMRFSamplerRandom_h
25 #include "itkMersenneTwisterRandomVariateGenerator.h"
26 #include "itkNumericTraits.h"
45 template <
class TInput1,
class TInput2>
71 this->m_EnergyBefore = this->m_EnergyFidelity->GetValue(itData, itRegul.GetCenterPixel());
72 this->m_EnergyBefore += this->m_Lambda * this->m_EnergyRegularization->GetValue(itRegul, itRegul.GetCenterPixel());
74 this->m_Value =
static_cast<LabelledImagePixelType>(m_Generator->GetIntegerVariate() % this->m_NumberOfClasses);
75 this->m_EnergyAfter = this->m_EnergyFidelity->GetValue(itData, this->m_Value);
76 this->m_EnergyAfter += this->m_Lambda * this->m_EnergyRegularization->GetValue(itRegul, this->m_Value);
77 this->m_DeltaEnergy = this->m_EnergyAfter - this->m_EnergyBefore;
85 m_Generator->SetSeed(seed);
89 m_Generator->SetSeed();
97 m_Generator = RandomGeneratorType::GetInstance();
98 m_Generator->SetSeed();