Orfeo Toolbox  4.2
otbSEMClassifier.h
Go to the documentation of this file.
1 #ifndef __otbSEMClassifier_h
2 #define __otbSEMClassifier_h
3 
4 #include "itkListSample.h"
7 
9 
11 
12 namespace otb
13 {
14 
42 template<class TInputImage, class TOutputImage>
43 class ITK_EXPORT SEMClassifier
45  typename itk::Statistics::ListSample<typename TInputImage::PixelType> >
46 {
47 public:
55 
57  itkTypeMacro(SEMClassifier, itk::Object);
58  itkNewMacro(Self);
59 
63 
66 
68  typedef unsigned int ClassLabelType;
69  typedef std::vector<ClassLabelType> ClassLabelVectorType;
70 
73 
79 
81  typedef std::vector<ComponentPointerType> ComponentVectorType;
82 
85 
87  typedef std::vector<ParameterType> ParameterVectorType;
88 
90  typedef std::vector<double> ProportionVectorType;
91  typedef std::vector<double> ProbaVectorType;
92 
94  typedef std::vector<ProbaVectorType> ProbaByClassVectorType;
95 
97  void SetSample(const TInputImage * sample);
98 
100  const TInputImage* GetSample() const;
101  SampleType * GetSampleList() const;
102 
107  void SetInitialProportions(ProportionVectorType& propotion);
108  ProportionVectorType* GetInitialProportions();
109 
111  ProportionVectorType* GetProportions();
112 
115  void SetClassLabels(OutputType * labels);
116  void SetClassLabels(TOutputImage * imgLabels);
117  ClassLabelVectorType& GetClassLabels();
118 
120  void SetNumberOfClasses(int theSize);
121  unsigned int GetNumberOfClasses();
122 
127  itkSetMacro(MaximumIteration, int);
128  itkGetMacro(MaximumIteration, int);
129 
132  void SetNeighborhood(int neighborhood);
133  int GetNeighborhood();
134 
136  int GetCurrentIteration();
137 
139  int AddComponent(int id, ComponentType* component);
140 
142  void Update();
143 
145  typedef enum { CONVERGED = 0, NOT_CONVERGED = 1 } TerminationCodeType;
146 
150  itkSetMacro(TerminationThreshold, double);
151  itkGetMacro(TerminationThreshold, double);
152 
154  itkGetMacro(TerminationCode, TerminationCodeType);
155 
156  /* Return the classification result (as a standard classification result) */
157  OutputType * GetOutput();
158 
159  /* Return the classification result (as an image) */
160  TOutputImage * GetOutputImage();
161 
162 protected:
163  SEMClassifier();
164  virtual ~SEMClassifier() {}
165  void PrintSelf(std::ostream& os, itk::Indent indent) const;
166 
169  void InitParameters();
171  void PerformStochasticProcess();
173  void PerformExpectationProcess();
177  void PerformMaximizationProcess();
179  void GetMaximumAposterioriLabels();
180 
181 private:
183  const TInputImage* m_Sample;
186 
193 
200 
203 
204  typename TOutputImage::Pointer m_OutputImage;
206 }; // end of class
207 
208 } // end of namespace
209 
210 #ifndef OTB_MANUAL_INSTANTIATION
211 #include "otbSEMClassifier.txx"
212 #endif
213 
214 #endif

Generated at Sat Aug 30 2014 16:24:27 for Orfeo Toolbox with doxygen 1.8.3.1