OTB  9.0.0
Orfeo Toolbox
Public Types | List of all members
otb::SEMClassifier< TInputImage, TOutputImage > Class Template Reference

#include <otbSEMClassifier.h>

+ Inheritance diagram for otb::SEMClassifier< TInputImage, TOutputImage >:
+ Collaboration diagram for otb::SEMClassifier< TInputImage, TOutputImage >:

Public Types

typedef itk::SmartPointer< const SelfConstPointer
 
typedef itk::SmartPointer< SelfPointer
 
typedef SEMClassifier Self
 
typedef itk::Statistics::SampleClassifierFilter< typename itk::Statistics::ListSample< typename TInputImage::PixelType > > Superclass
 
enum  TerminationCodeType {
  CONVERGED = 0,
  NOT_CONVERGED = 1
}
 
typedef itk::Statistics::ListSample< typename TInputImage::PixelType > SampleType
 
typedef itk::Statistics::Subsample< SampleTypeClassSampleType
 
typedef SampleType::MeasurementType MeasurementType
 
typedef SampleType::MeasurementVectorType MeasurementVectorType
 
typedef unsigned int ClassLabelType
 
typedef std::vector< ClassLabelTypeClassLabelVectorType
 
typedef itk::Statistics::MembershipSample< SampleTypeOutputType
 
typedef otb::Statistics::ModelComponentBase< ClassSampleTypeComponentType
 
typedef ComponentType::Pointer ComponentPointerType
 
typedef std::vector< ComponentPointerTypeComponentVectorType
 
typedef itk::Array< double > ParameterType
 
typedef std::vector< ParameterTypeParameterVectorType
 
typedef std::vector< double > ProportionVectorType
 
typedef std::vector< double > ProbaVectorType
 
typedef std::vector< ProbaVectorTypeProbaByClassVectorType
 
const TInputImage * m_Sample
 
int m_NbSamples
 
SampleType::Pointer m_SampleList
 
int m_MaximumIteration
 
int m_CurrentIteration
 
int m_NbChange
 
double m_TerminationThreshold
 
int m_Neighborhood
 
TerminationCodeType m_TerminationCode
 
ComponentVectorType m_ComponentVector
 
ProportionVectorType m_InitialProportions
 
ProportionVectorType m_Proportions
 
ProbaByClassVectorType m_Proba
 
ClassLabelVectorType m_ClassLabels
 
int m_ExternalLabels
 
int m_ComponentDeclared
 
TOutputImage::Pointer m_OutputImage
 
OutputType::Pointer m_Output
 
virtual const char * GetNameOfClass () const
 
virtual ::itk::LightObject::Pointer CreateAnother (void) const
 
void SetSample (const TInputImage *sample)
 
const TInputImage * GetSample () const
 
SampleTypeGetSampleList () const
 
void SetInitialProportions (ProportionVectorType &proportions)
 
virtual const ProportionVectorTypeGetInitialProportions () const
 
virtual const ProportionVectorTypeGetProportions () const
 
void SetClassLabels (OutputType *labels)
 
void SetClassLabels (TOutputImage *imgLabels)
 
ClassLabelVectorTypeGetClassLabels ()
 
virtual void SetMaximumIteration (int _arg)
 
virtual int GetMaximumIteration ()
 
void SetNeighborhood (int neighborhood)
 
int GetNeighborhood ()
 
int GetCurrentIteration ()
 
int AddComponent (int id, ComponentType *component)
 
void Update () override
 
virtual void SetTerminationThreshold (double _arg)
 
virtual double GetTerminationThreshold ()
 
virtual TerminationCodeType GetTerminationCode ()
 
OutputTypeGetOutput ()
 
TOutputImage * GetOutputImage ()
 
void Modified () const override
 
static Pointer New ()
 
 SEMClassifier ()
 
 ~SEMClassifier () override
 
void PrintSelf (std::ostream &os, itk::Indent indent) const override
 
void InitParameters ()
 
void PerformStochasticProcess ()
 
void PerformExpectationProcess ()
 
void PerformMaximizationProcess ()
 
void GetMaximumAposterioriLabels ()
 

Detailed Description

template<class TInputImage, class TOutputImage>
class otb::SEMClassifier< TInputImage, TOutputImage >

This class implements the Stochastic Expectation Maximization algorithm to perform an estimation of a mixture model.

The first template argument is the type of the target sample data. This estimator expects one or more model component objects of the classes derived from the ModelComponentBase. The actual component (or module) parameters are updated by each component. Users can think this class as a strategy or a integration point for the SEM procedure.

The number of classes (SetNumberOfClasses), the initial proportion (SetInitialProportions), the input sample (SetSample), the model components (AddComponent), and the maximum iteration (SetMaximumIteration) are required. The SEM procedure terminates when the current iteration reaches the maximum iteration or the model parameters converge.

The difference from ExpectationMaximizationMixtureModelEstimator is that SEMClassifier include the maximum a posteriori decision on each sample. The class is to be seen as a classification and not an estimator.

Recent API changes: N/A

See also
ModelComponentBase, GaussianModelComponent

Definition at line 64 of file otbSEMClassifier.h.

Member Typedef Documentation

◆ ClassLabelType

template<class TInputImage , class TOutputImage >
typedef unsigned int otb::SEMClassifier< TInputImage, TOutputImage >::ClassLabelType

Type of the segmentation vector

Definition at line 86 of file otbSEMClassifier.h.

◆ ClassLabelVectorType

template<class TInputImage , class TOutputImage >
typedef std::vector<ClassLabelType> otb::SEMClassifier< TInputImage, TOutputImage >::ClassLabelVectorType

Termination status after running optimization

Definition at line 87 of file otbSEMClassifier.h.

◆ ClassSampleType

template<class TInputImage , class TOutputImage >
typedef itk::Statistics::Subsample<SampleType> otb::SEMClassifier< TInputImage, TOutputImage >::ClassSampleType

Termination status after running optimization

Definition at line 80 of file otbSEMClassifier.h.

◆ ComponentPointerType

template<class TInputImage , class TOutputImage >
typedef ComponentType::Pointer otb::SEMClassifier< TInputImage, TOutputImage >::ComponentPointerType

Termination status after running optimization

Definition at line 96 of file otbSEMClassifier.h.

◆ ComponentType

template<class TInputImage , class TOutputImage >
typedef otb::Statistics::ModelComponentBase<ClassSampleType> otb::SEMClassifier< TInputImage, TOutputImage >::ComponentType

Type of the mixture model component base class. Due to the stochastic purpose, the initial list of sample (from TInputImage) is duplicated as many times as the number of classes (into SampleLists).

Definition at line 95 of file otbSEMClassifier.h.

◆ ComponentVectorType

template<class TInputImage , class TOutputImage >
typedef std::vector<ComponentPointerType> otb::SEMClassifier< TInputImage, TOutputImage >::ComponentVectorType

Type of the component pointer storage, one component per class

Definition at line 100 of file otbSEMClassifier.h.

◆ ConstPointer

template<class TInputImage , class TOutputImage >
typedef itk::SmartPointer<const Self> otb::SEMClassifier< TInputImage, TOutputImage >::ConstPointer

Definition at line 71 of file otbSEMClassifier.h.

◆ MeasurementType

template<class TInputImage , class TOutputImage >
typedef SampleType::MeasurementType otb::SEMClassifier< TInputImage, TOutputImage >::MeasurementType

Termination status after running optimization

Definition at line 82 of file otbSEMClassifier.h.

◆ MeasurementVectorType

template<class TInputImage , class TOutputImage >
typedef SampleType::MeasurementVectorType otb::SEMClassifier< TInputImage, TOutputImage >::MeasurementVectorType

Termination status after running optimization

Definition at line 83 of file otbSEMClassifier.h.

◆ OutputType

template<class TInputImage , class TOutputImage >
typedef itk::Statistics::MembershipSample<SampleType> otb::SEMClassifier< TInputImage, TOutputImage >::OutputType

Output type for GetClassSample method

Definition at line 90 of file otbSEMClassifier.h.

◆ ParameterType

template<class TInputImage , class TOutputImage >
typedef itk::Array<double> otb::SEMClassifier< TInputImage, TOutputImage >::ParameterType

type of the parameters needed for the component vectors

Definition at line 103 of file otbSEMClassifier.h.

◆ ParameterVectorType

template<class TInputImage , class TOutputImage >
typedef std::vector<ParameterType> otb::SEMClassifier< TInputImage, TOutputImage >::ParameterVectorType

Type of the parameter pointer storage, one parameter set per class

Definition at line 106 of file otbSEMClassifier.h.

◆ Pointer

template<class TInputImage , class TOutputImage >
typedef itk::SmartPointer<Self> otb::SEMClassifier< TInputImage, TOutputImage >::Pointer

Definition at line 70 of file otbSEMClassifier.h.

◆ ProbaByClassVectorType

template<class TInputImage , class TOutputImage >
typedef std::vector<ProbaVectorType> otb::SEMClassifier< TInputImage, TOutputImage >::ProbaByClassVectorType

Type of the probability values of each sample per class

Definition at line 113 of file otbSEMClassifier.h.

◆ ProbaVectorType

template<class TInputImage , class TOutputImage >
typedef std::vector<double> otb::SEMClassifier< TInputImage, TOutputImage >::ProbaVectorType

Termination status after running optimization

Definition at line 110 of file otbSEMClassifier.h.

◆ ProportionVectorType

template<class TInputImage , class TOutputImage >
typedef std::vector<double> otb::SEMClassifier< TInputImage, TOutputImage >::ProportionVectorType

Type of the vector of the probability values for each sample

Definition at line 109 of file otbSEMClassifier.h.

◆ SampleType

template<class TInputImage , class TOutputImage >
typedef itk::Statistics::ListSample<typename TInputImage::PixelType> otb::SEMClassifier< TInputImage, TOutputImage >::SampleType

TSample template argument related typedefs

Definition at line 75 of file otbSEMClassifier.h.

◆ Self

template<class TInputImage , class TOutputImage >
typedef SEMClassifier otb::SEMClassifier< TInputImage, TOutputImage >::Self

Standard class typedef

Definition at line 68 of file otbSEMClassifier.h.

◆ Superclass

template<class TInputImage , class TOutputImage >
typedef itk::Statistics::SampleClassifierFilter<typename itk::Statistics::ListSample<typename TInputImage::PixelType> > otb::SEMClassifier< TInputImage, TOutputImage >::Superclass

Definition at line 69 of file otbSEMClassifier.h.

Member Enumeration Documentation

◆ TerminationCodeType

template<class TInputImage , class TOutputImage >
enum otb::SEMClassifier::TerminationCodeType

Termination status after running optimization

Enumerator
CONVERGED 
NOT_CONVERGED 

Definition at line 165 of file otbSEMClassifier.h.

Constructor & Destructor Documentation

◆ SEMClassifier()

template<class TInputImage , class TOutputImage >
otb::SEMClassifier< TInputImage, TOutputImage >::SEMClassifier
protected

Termination status after running optimization

Definition at line 41 of file otbSEMClassifier.hxx.

◆ ~SEMClassifier()

template<class TInputImage , class TOutputImage >
otb::SEMClassifier< TInputImage, TOutputImage >::~SEMClassifier ( )
inlineoverrideprotected

Termination status after running optimization

Definition at line 187 of file otbSEMClassifier.h.

Member Function Documentation

◆ AddComponent()

template<class TInputImage , class TOutputImage >
int otb::SEMClassifier< TInputImage, TOutputImage >::AddComponent ( int  id,
ComponentType component 
)

Adds a new component (or class). Has to be called after SetNumberOfClasses

Definition at line 244 of file otbSEMClassifier.hxx.

◆ CreateAnother()

template<class TInputImage , class TOutputImage >
virtual::itk::LightObject::Pointer otb::SEMClassifier< TInputImage, TOutputImage >::CreateAnother ( void  ) const

Termination status after running optimization

◆ GetClassLabels()

template<class TInputImage , class TOutputImage >
SEMClassifier< TInputImage, TOutputImage >::ClassLabelVectorType & otb::SEMClassifier< TInputImage, TOutputImage >::GetClassLabels

Termination status after running optimization

Definition at line 192 of file otbSEMClassifier.hxx.

◆ GetCurrentIteration()

template<class TInputImage , class TOutputImage >
int otb::SEMClassifier< TInputImage, TOutputImage >::GetCurrentIteration

Gets the current iteration.

Definition at line 238 of file otbSEMClassifier.hxx.

◆ GetInitialProportions()

template<class TInputImage , class TOutputImage >
virtual const ProportionVectorType& otb::SEMClassifier< TInputImage, TOutputImage >::GetInitialProportions ( ) const
virtual

Termination status after running optimization

◆ GetMaximumAposterioriLabels()

template<class TInputImage , class TOutputImage >
void otb::SEMClassifier< TInputImage, TOutputImage >::GetMaximumAposterioriLabels
protected

Make Decision through a Maximum a posteriori

Definition at line 525 of file otbSEMClassifier.hxx.

◆ GetMaximumIteration()

template<class TInputImage , class TOutputImage >
virtual int otb::SEMClassifier< TInputImage, TOutputImage >::GetMaximumIteration ( )
virtual

Termination status after running optimization

◆ GetNameOfClass()

template<class TInputImage , class TOutputImage >
virtual const char* otb::SEMClassifier< TInputImage, TOutputImage >::GetNameOfClass ( ) const
virtual

Standard macros

◆ GetNeighborhood()

template<class TInputImage , class TOutputImage >
int otb::SEMClassifier< TInputImage, TOutputImage >::GetNeighborhood

Termination status after running optimization

Definition at line 81 of file otbSEMClassifier.hxx.

◆ GetOutput()

template<class TInputImage , class TOutputImage >
SEMClassifier< TInputImage, TOutputImage >::OutputType * otb::SEMClassifier< TInputImage, TOutputImage >::GetOutput

Termination status after running optimization

Definition at line 270 of file otbSEMClassifier.hxx.

◆ GetOutputImage()

template<class TInputImage , class TOutputImage >
TOutputImage * otb::SEMClassifier< TInputImage, TOutputImage >::GetOutputImage

Termination status after running optimization

Definition at line 264 of file otbSEMClassifier.hxx.

◆ GetProportions()

template<class TInputImage , class TOutputImage >
virtual const ProportionVectorType& otb::SEMClassifier< TInputImage, TOutputImage >::GetProportions ( ) const
virtual

Gets the result proportion values

◆ GetSample()

template<class TInputImage , class TOutputImage >
const TInputImage * otb::SEMClassifier< TInputImage, TOutputImage >::GetSample

Returns the target data

Definition at line 226 of file otbSEMClassifier.hxx.

◆ GetSampleList()

template<class TInputImage , class TOutputImage >
SEMClassifier< TInputImage, TOutputImage >::SampleType * otb::SEMClassifier< TInputImage, TOutputImage >::GetSampleList

Termination status after running optimization

Definition at line 232 of file otbSEMClassifier.hxx.

◆ GetTerminationCode()

template<class TInputImage , class TOutputImage >
virtual TerminationCodeType otb::SEMClassifier< TInputImage, TOutputImage >::GetTerminationCode ( )
virtual

Gets the termination status

◆ GetTerminationThreshold()

template<class TInputImage , class TOutputImage >
virtual double otb::SEMClassifier< TInputImage, TOutputImage >::GetTerminationThreshold ( )
virtual

Termination status after running optimization

◆ InitParameters()

template<class TInputImage , class TOutputImage >
void otb::SEMClassifier< TInputImage, TOutputImage >::InitParameters
protected

Initialize the first segmentation, either randomly or by using a ClassLabelVectorType given in SetClassLabels.

Definition at line 276 of file otbSEMClassifier.hxx.

References otbMsgDebugMacro, and otbMsgDevMacro.

◆ Modified()

template<class TInputImage , class TOutputImage >
void otb::SEMClassifier< TInputImage, TOutputImage >::Modified
override

Termination status after running optimization

Definition at line 253 of file otbSEMClassifier.hxx.

References otbMsgDebugMacro.

◆ New()

template<class TInputImage , class TOutputImage >
static Pointer otb::SEMClassifier< TInputImage, TOutputImage >::New ( )
static

Termination status after running optimization

◆ PerformExpectationProcess()

template<class TInputImage , class TOutputImage >
void otb::SEMClassifier< TInputImage, TOutputImage >::PerformExpectationProcess
protected

Estimation part of the SEM

Definition at line 403 of file otbSEMClassifier.hxx.

◆ PerformMaximizationProcess()

template<class TInputImage , class TOutputImage >
void otb::SEMClassifier< TInputImage, TOutputImage >::PerformMaximizationProcess
protected

Maximization part of the SEM. This method should be upgraded this a contextual point of view... It required to a Neighborhood knowledge into the TSample type...

Definition at line 454 of file otbSEMClassifier.hxx.

◆ PerformStochasticProcess()

template<class TInputImage , class TOutputImage >
void otb::SEMClassifier< TInputImage, TOutputImage >::PerformStochasticProcess
protected

Stochastic part of the SEM

Definition at line 361 of file otbSEMClassifier.hxx.

References otbMsgDebugMacro.

◆ PrintSelf()

template<class TInputImage , class TOutputImage >
void otb::SEMClassifier< TInputImage, TOutputImage >::PrintSelf ( std::ostream &  os,
itk::Indent  indent 
) const
overrideprotected

Termination status after running optimization

Definition at line 58 of file otbSEMClassifier.hxx.

◆ SetClassLabels() [1/2]

template<class TInputImage , class TOutputImage >
void otb::SEMClassifier< TInputImage, TOutputImage >::SetClassLabels ( OutputType labels)

Set/Gets the initial segmentation. the size of the vector should be the same as the number of samples (length of MeasurementVector)

Definition at line 94 of file otbSEMClassifier.hxx.

References otbMsgDebugMacro.

◆ SetClassLabels() [2/2]

template<class TInputImage , class TOutputImage >
void otb::SEMClassifier< TInputImage, TOutputImage >::SetClassLabels ( TOutputImage *  imgLabels)

Termination status after running optimization

Definition at line 139 of file otbSEMClassifier.hxx.

References otbMsgDebugMacro.

◆ SetInitialProportions()

template<class TInputImage , class TOutputImage >
void otb::SEMClassifier< TInputImage, TOutputImage >::SetInitialProportions ( ProportionVectorType proportions)

Set/Gets the initial proportion values. The size of proportion vector should be same as the number of component (or classes). Choose between SetInitialProportions, SetClassLabels or SetNumberOfComponents

Definition at line 87 of file otbSEMClassifier.hxx.

◆ SetMaximumIteration()

template<class TInputImage , class TOutputImage >
virtual void otb::SEMClassifier< TInputImage, TOutputImage >::SetMaximumIteration ( int  _arg)
virtual

Set/Gets the maximum number of iterations. When the optimization process reaches the maximum number of iterations, even if the class parameters aren't converged, the optimization process stops.

◆ SetNeighborhood()

template<class TInputImage , class TOutputImage >
void otb::SEMClassifier< TInputImage, TOutputImage >::SetNeighborhood ( int  neighborhood)

Set/Gets the neighborhood to take into consideration in the contextual decision rule. Should be odd (def. 3).

Definition at line 73 of file otbSEMClassifier.hxx.

◆ SetSample()

template<class TInputImage , class TOutputImage >
void otb::SEMClassifier< TInputImage, TOutputImage >::SetSample ( const TInputImage *  sample)

Sets the target data that will be classified by this

Definition at line 198 of file otbSEMClassifier.hxx.

◆ SetTerminationThreshold()

template<class TInputImage , class TOutputImage >
virtual void otb::SEMClassifier< TInputImage, TOutputImage >::SetTerminationThreshold ( double  _arg)
virtual

Set/Get the termination threshold (ratio of the number of sample that change affected class during iteration over the total number of samples (def is 1E-5)

◆ Update()

template<class TInputImage , class TOutputImage >
void otb::SEMClassifier< TInputImage, TOutputImage >::Update
override

Runs the optimization process.

Definition at line 571 of file otbSEMClassifier.hxx.

Member Data Documentation

◆ m_ClassLabels

template<class TInputImage , class TOutputImage >
ClassLabelVectorType otb::SEMClassifier< TInputImage, TOutputImage >::m_ClassLabels
private

Termination status after running optimization

Definition at line 227 of file otbSEMClassifier.h.

◆ m_ComponentDeclared

template<class TInputImage , class TOutputImage >
int otb::SEMClassifier< TInputImage, TOutputImage >::m_ComponentDeclared
mutableprivate

Termination status after running optimization

Definition at line 230 of file otbSEMClassifier.h.

◆ m_ComponentVector

template<class TInputImage , class TOutputImage >
ComponentVectorType otb::SEMClassifier< TInputImage, TOutputImage >::m_ComponentVector
mutableprivate

Termination status after running optimization

Definition at line 223 of file otbSEMClassifier.h.

◆ m_CurrentIteration

template<class TInputImage , class TOutputImage >
int otb::SEMClassifier< TInputImage, TOutputImage >::m_CurrentIteration
private

Termination status after running optimization

Definition at line 217 of file otbSEMClassifier.h.

◆ m_ExternalLabels

template<class TInputImage , class TOutputImage >
int otb::SEMClassifier< TInputImage, TOutputImage >::m_ExternalLabels
private

Termination status after running optimization

Definition at line 229 of file otbSEMClassifier.h.

◆ m_InitialProportions

template<class TInputImage , class TOutputImage >
ProportionVectorType otb::SEMClassifier< TInputImage, TOutputImage >::m_InitialProportions
private

Termination status after running optimization

Definition at line 224 of file otbSEMClassifier.h.

◆ m_MaximumIteration

template<class TInputImage , class TOutputImage >
int otb::SEMClassifier< TInputImage, TOutputImage >::m_MaximumIteration
private

Termination status after running optimization

Definition at line 216 of file otbSEMClassifier.h.

◆ m_NbChange

template<class TInputImage , class TOutputImage >
int otb::SEMClassifier< TInputImage, TOutputImage >::m_NbChange
private

Termination status after running optimization

Definition at line 218 of file otbSEMClassifier.h.

◆ m_NbSamples

template<class TInputImage , class TOutputImage >
int otb::SEMClassifier< TInputImage, TOutputImage >::m_NbSamples
private

Termination status after running optimization

Definition at line 213 of file otbSEMClassifier.h.

◆ m_Neighborhood

template<class TInputImage , class TOutputImage >
int otb::SEMClassifier< TInputImage, TOutputImage >::m_Neighborhood
private

Termination status after running optimization

Definition at line 220 of file otbSEMClassifier.h.

◆ m_Output

template<class TInputImage , class TOutputImage >
OutputType::Pointer otb::SEMClassifier< TInputImage, TOutputImage >::m_Output
private

Termination status after running optimization

Definition at line 233 of file otbSEMClassifier.h.

◆ m_OutputImage

template<class TInputImage , class TOutputImage >
TOutputImage::Pointer otb::SEMClassifier< TInputImage, TOutputImage >::m_OutputImage
private

Termination status after running optimization

Definition at line 232 of file otbSEMClassifier.h.

◆ m_Proba

template<class TInputImage , class TOutputImage >
ProbaByClassVectorType otb::SEMClassifier< TInputImage, TOutputImage >::m_Proba
private

Termination status after running optimization

Definition at line 226 of file otbSEMClassifier.h.

◆ m_Proportions

template<class TInputImage , class TOutputImage >
ProportionVectorType otb::SEMClassifier< TInputImage, TOutputImage >::m_Proportions
private

Termination status after running optimization

Definition at line 225 of file otbSEMClassifier.h.

◆ m_Sample

template<class TInputImage , class TOutputImage >
const TInputImage* otb::SEMClassifier< TInputImage, TOutputImage >::m_Sample
private

Target data sample pointer

Definition at line 212 of file otbSEMClassifier.h.

◆ m_SampleList

template<class TInputImage , class TOutputImage >
SampleType::Pointer otb::SEMClassifier< TInputImage, TOutputImage >::m_SampleList
private

Termination status after running optimization

Definition at line 214 of file otbSEMClassifier.h.

◆ m_TerminationCode

template<class TInputImage , class TOutputImage >
TerminationCodeType otb::SEMClassifier< TInputImage, TOutputImage >::m_TerminationCode
private

Termination status after running optimization

Definition at line 222 of file otbSEMClassifier.h.

◆ m_TerminationThreshold

template<class TInputImage , class TOutputImage >
double otb::SEMClassifier< TInputImage, TOutputImage >::m_TerminationThreshold
private

Termination status after running optimization

Definition at line 219 of file otbSEMClassifier.h.


The documentation for this class was generated from the following files: