Orfeo Toolbox  3.16
otbSEMClassifier.h
Go to the documentation of this file.
1 #ifndef __otbSEMClassifier_h
2 #define __otbSEMClassifier_h
3 
4 #include "itkListSample.h"
5 #include "itkSampleClassifier.h"
7 
9 
11 
12 namespace otb
13 {
14 
42 template<class TInputImage, class TOutputImage>
45  typename itk::Statistics::ListSample<typename TInputImage::PixelType> >
46 {
47 public:
50  //typedef itk::Object Superclass;
56 
58  itkTypeMacro(SEMClassifier, itk::Object);
59  itkNewMacro(Self);
60 
64 
67 
69  typedef unsigned int ClassLabelType;
70  typedef std::vector<ClassLabelType> ClassLabelVectorType;
71 
74 
80 
82  typedef std::vector<ComponentPointerType> ComponentVectorType;
83 
86 
88  typedef std::vector<ParameterType> ParameterVectorType;
89 
91  typedef std::vector<double> ProportionVectorType;
92  typedef std::vector<double> ProbaVectorType;
93 
95  typedef std::vector<ProbaVectorType> ProbaByClassVectorType;
96 
98  void SetSample(const TInputImage * sample);
99 
101  const TInputImage* GetSample() const;
102  SampleType * GetSampleList() const;
103 
108  void SetInitialProportions(ProportionVectorType& propotion);
109  ProportionVectorType* GetInitialProportions();
110 
112  ProportionVectorType* GetProportions();
113 
116  void SetClassLabels(OutputType * labels);
117  void SetClassLabels(TOutputImage * imgLabels);
118  ClassLabelVectorType& GetClassLabels();
119 
121  void SetNumberOfClasses(int theSize);
122  unsigned int GetNumberOfClasses();
123 
128  itkSetMacro(MaximumIteration, int);
129  itkGetMacro(MaximumIteration, int);
130 
133  void SetNeighborhood(int neighborhood);
134  int GetNeighborhood();
135 
137  int GetCurrentIteration();
138 
140  int AddComponent(int id, ComponentType* component);
141 
143  void Update();
144 
146  typedef enum { CONVERGED = 0, NOT_CONVERGED = 1 } TerminationCodeType;
147 
151  itkSetMacro(TerminationThreshold, double);
152  itkGetMacro(TerminationThreshold, double);
153 
155  itkGetMacro(TerminationCode, TerminationCodeType);
156 
157  /* Return the classification result (as a standard classification result) */
158  OutputType * GetOutput();
159 
160  /* Return the classification result (as an image) */
161  TOutputImage * GetOutputImage();
162 
163 protected:
164  SEMClassifier();
165  virtual ~SEMClassifier() {}
166  void PrintSelf(std::ostream& os, itk::Indent indent) const;
167 
170  void InitParameters();
172  void PerformStochasticProcess();
174  void PerformExpectationProcess();
178  void PerformMaximizationProcess();
180  void GetMaximumAposterioriLabels();
181 
182 private:
184  const TInputImage* m_Sample;
187 
194 
201 
204 
205  typename TOutputImage::Pointer m_OutputImage;
207 }; // end of class
208 
209 } // end of namespace
210 
211 #ifndef OTB_MANUAL_INSTANTIATION
212 #include "otbSEMClassifier.txx"
213 #endif
214 
215 #endif

Generated at Sun Feb 3 2013 00:46:54 for Orfeo Toolbox with doxygen 1.8.1.1