22 #ifndef otbMRFSamplerMAP_h
23 #define otbMRFSamplerMAP_h
44 template <
class TInput1,
class TInput2>
68 if (this->m_NumberOfClasses == 0)
70 itkExceptionMacro(<<
"NumberOfClasses has to be greater than 0.");
73 this->m_EnergyBefore = this->m_EnergyFidelity->GetValue(itData, itRegul.GetCenterPixel());
74 this->m_EnergyBefore += this->m_Lambda * this->m_EnergyRegularization->GetValue(itRegul, itRegul.GetCenterPixel());
77 this->m_EnergyAfter = this->m_EnergyBefore;
78 this->m_Value = itRegul.GetCenterPixel();
81 while (valueCurrent <
static_cast<LabelledImagePixelType>(this->GetNumberOfClasses()) && valueCurrent != itk::NumericTraits<LabelledImagePixelType>::max())
83 this->m_EnergyCurrent = this->m_EnergyFidelity->GetValue(itData, valueCurrent);
84 this->m_EnergyCurrent += this->m_Lambda * this->m_EnergyRegularization->GetValue(itRegul, valueCurrent);
85 if (this->m_EnergyCurrent < this->m_EnergyAfter)
87 this->m_EnergyAfter = this->m_EnergyCurrent;
88 this->m_Value = valueCurrent;
93 this->m_DeltaEnergy = this->m_EnergyAfter - this->m_EnergyBefore;
This is the base class for sampler methods used in the MRF framework.
~MRFSamplerMAP() override
Superclass::EnergyFidelityType EnergyFidelityType
Superclass::InputImagePixelType InputImagePixelType
itk::SmartPointer< const Self > ConstPointer
Superclass::EnergyRegularizationPointer EnergyRegularizationPointer
itk::SmartPointer< Self > Pointer
Superclass::LabelledImagePixelType LabelledImagePixelType
Superclass::EnergyRegularizationType EnergyRegularizationType
int Compute(const InputImageNeighborhoodIterator &itData, const LabelledImageNeighborhoodIterator &itRegul) override
Superclass::EnergyFidelityPointer EnergyFidelityPointer
MRFSampler< TInput1, TInput2 > Superclass
Superclass::InputImageNeighborhoodIterator InputImageNeighborhoodIterator
Superclass::LabelledImageNeighborhoodIterator LabelledImageNeighborhoodIterator
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.