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();
This is the base class for sampler methods used in the MRF framework.
~MRFSamplerRandom() override
itk::SmartPointer< Self > Pointer
Superclass::EnergyRegularizationType EnergyRegularizationType
RandomGeneratorType::Pointer m_Generator
Superclass::LabelledImagePixelType LabelledImagePixelType
Superclass::LabelledImageNeighborhoodIterator LabelledImageNeighborhoodIterator
Superclass::EnergyRegularizationPointer EnergyRegularizationPointer
Superclass::EnergyFidelityType EnergyFidelityType
Superclass::InputImagePixelType InputImagePixelType
Superclass::EnergyFidelityPointer EnergyFidelityPointer
void InitializeSeed(int seed)
otb::MRFSampler< TInput1, TInput2 > Superclass
itk::SmartPointer< const Self > ConstPointer
int Compute(const InputImageNeighborhoodIterator &itData, const LabelledImageNeighborhoodIterator &itRegul) override
itk::Statistics::MersenneTwisterRandomVariateGenerator RandomGeneratorType
Superclass::InputImageNeighborhoodIterator InputImageNeighborhoodIterator
This is the base class for sampler methods used in the MRF framework.
itk::ConstNeighborhoodIterator< TInput1 > InputImageNeighborhoodIterator
itk::NeighborhoodIterator< TInput2 > LabelledImageNeighborhoodIterator
TInput2::PixelType LabelledImagePixelType
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.