Orfeo Toolbox  3.16
otbSVMMarginSampler.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ORFEO Toolbox
4  Language: C++
5  Date: $Date$
6  Version: $Revision$
7 
8 
9  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
10  See OTBCopyright.txt for details.
11 
12 
13  This software is distributed WITHOUT ANY WARRANTY; without even
14  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  PURPOSE. See the above copyright notices for more information.
16 
17 =========================================================================*/
18 #ifndef __otbSVMMarginSampler_h
19 #define __otbSVMMarginSampler_h
20 
21 #include "itkSampleClassifier.h"
22 #include "itkVectorImage.h"
23 
24 namespace otb
25 {
26 
32 template< class TSample, class TModel >
34  public itk::Statistics::SampleClassifier< TSample >
35 {
36 public:
42 
45  itkNewMacro(Self);
46 
49 
51  typedef typename TSample::MeasurementType MeasurementType;
52  typedef typename TSample::MeasurementVectorType MeasurementVectorType;
53  typedef std::pair<unsigned int, double> IndexAndDistanceType;
54  typedef std::vector<IndexAndDistanceType> IndexAndDistanceVectorType;
55  typedef std::vector<unsigned int> IndexVectorType;
56 
57 
58  static bool Compare(const IndexAndDistanceType& l1, const IndexAndDistanceType & l2)
59  {
60  bool resp = l2.second > l1.second;
61  return resp;
62  }
63 
64 
66  typedef typename Superclass::MembershipFunctionPointerVector
68 
70  OutputType* GetOutput();
71  void SetOutput(OutputType* output);
72 
74  typedef TModel SVMModelType;
75  typedef typename SVMModelType::Pointer SVMModelPointer;
76  typedef typename SVMModelType::DistancesVectorType DistancesVectorType;
77 
78  itkSetMacro(NumberOfCandidates, unsigned int);
79  itkGetMacro(NumberOfCandidates, unsigned int);
80 
82  itkSetObjectMacro(Model, SVMModelType);
83 
85  itkGetObjectMacro(Model, SVMModelType);
86 
87  void Update();
88 
89  const IndexVectorType & GetMarginSamples()
90  {
91  return m_MarginSamples;
92  }
93 
94 protected:
96  virtual ~SVMMarginSampler() {}
97  void PrintSelf(std::ostream& os, itk::Indent indent) const;
98 
100  void GenerateData();
101  virtual void DoMarginSampling();
102 
103 private:
106 
108 
109  unsigned int m_NumberOfCandidates;
110 
112 
113 }; // end of class
114 
115 
116 } // end of namespace otb
117 
118 
119 #ifndef OTB_MANUAL_INSTANTIATION
120 #include "otbSVMMarginSampler.txx"
121 #endif
122 
123 #endif
124 
125 

Generated at Sun May 19 2013 00:53:37 for Orfeo Toolbox with doxygen 1.8.3.1