ClassifierEDStrategy.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/rp/ClassifierEDStrategy.h
22  \brief Euclidean Distance Classifier strategy.
23  */
24 
25 #ifndef __TERRALIB_RP_INTERNAL_CLASSIFIEREDSTRATEGY_H
26 #define __TERRALIB_RP_INTERNAL_CLASSIFIEREDSTRATEGY_H
27 
28 #include "ClassifierStrategy.h"
30 #include "../common/progress/TaskProgress.h"
31 #include "Config.h"
32 
33 #include <boost/numeric/ublas/matrix.hpp>
34 #include <boost/shared_ptr.hpp>
35 
36 #include <map>
37 #include <vector>
38 
39 namespace te
40 {
41  namespace rp
42  {
43  /*!
44  \class ClassifierEDStrategy
45 
46  \brief Euclidean Distance Classifier strategy.
47 
48  \ingroup rp_class
49  */
51  {
52  public:
53 
54  /*!
55  \class Parameters
56 
57  \brief Classifier Parameters
58  */
60  {
61  public:
62 
63  typedef unsigned int ClassIDT; //!< Class ID type definition (zero means invalid ID).
64 
65  typedef std::vector< double > ClassSampleT; //!< Class sample type definition.
66 
67  typedef std::vector< ClassSampleT > ClassSamplesContainerT; //!< Class samples container type definition.
68 
69  typedef std::map< ClassIDT, ClassSamplesContainerT > MClassesSamplesCT; //!< Multi-classes samples container type definition.
70 
71  typedef boost::shared_ptr<MClassesSamplesCT> MClassesSamplesCTPtr; //!< A shared pointer to a multi classes samples container type definition.
72 
73  MClassesSamplesCTPtr m_trainSamplesPtr; //!< A shared pointer to a always-valid structure where trainning samples are stored.
74 
76 
78 
79  //overload
80  const Parameters& operator=(const Parameters& params);
81 
82  //overload
83  void reset() _NOEXCEPT_OP(false);
84 
85  //overload
86  AbstractParameters* clone() const;
87  };
88 
90 
92 
93  //overload
94  bool initialize(ClassifierStrategyParameters const* const strategyParams) _NOEXCEPT_OP(false);
95 
96  //overload
97  bool execute() _NOEXCEPT_OP(false);
98 
99  unsigned int getOutputNumberBands(void);
100 
101  protected :
102 
103  bool m_isInitialized; //!< Is this instance initialized?
104 
105  Parameters::ClassIDT m_highestTrainClassID; //!< The highest train class ID.
106 
107  ClassifierEDStrategy::Parameters m_initParams; //!< Initialization parameters.
108 
109  std::vector< Parameters::ClassIDT > m_classesIndex2ID; //!< An class index ordered vector of classes IDs;
110 
111  std::vector< std::vector< double > > m_classesMeans; //!< Classes means;
112 
113  };
114 
115  /*!
116  \class ClassifierEDStrategyFactory
117 
118  \brief Euclidean Distance strategy factory.
119 
120  \note Factory key: RegionGrowing
121  */
123  {
124  public:
125 
127 
129 
130  //overload
132  };
133 
134  } // end namespace rp
135 } // end namespace te
136 
137 #endif // __TERRALIB_RP_INTERNAL_CLASSIFIEREDSTRATEGY_H
138 
te::rp::ClassifierEDStrategy
Euclidean Distance Classifier strategy.
Definition: ClassifierEDStrategy.h:51
te::rp::ClassifierEDStrategy::Parameters::m_trainSamplesPtr
MClassesSamplesCTPtr m_trainSamplesPtr
A shared pointer to a always-valid structure where trainning samples are stored.
Definition: ClassifierEDStrategy.h:73
te::rp::ClassifierEDStrategyFactory
Euclidean Distance strategy factory.
Definition: ClassifierEDStrategy.h:123
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::rp::ClassifierStrategyParameters
Classifier Strategy Parameters.
Definition: ClassifierStrategyParameters.h:42
_NOEXCEPT_OP
#define _NOEXCEPT_OP(x)
Definition: NoExceptDefinition.h:36
te::rp::ClassifierEDStrategy::Parameters
Classifier Parameters.
Definition: ClassifierEDStrategy.h:60
ClassifierStrategy.h
Raster classifier strategy base class.
te::rp::ClassifierEDStrategy::Parameters::~Parameters
~Parameters()
te::rp::ClassifierEDStrategy::Parameters::Parameters
Parameters()
te::rp::ClassifierEDStrategyFactory::build
te::rp::ClassifierStrategy * build()
Concrete factories (derived from this one) must implement this method in order to create objects.
te::rp::ClassifierEDStrategyFactory::ClassifierEDStrategyFactory
ClassifierEDStrategyFactory()
te::rp::ClassifierEDStrategy::Parameters::ClassSamplesContainerT
std::vector< ClassSampleT > ClassSamplesContainerT
Class samples container type definition.
Definition: ClassifierEDStrategy.h:67
te::rp::ClassifierEDStrategy::Parameters::operator=
const Parameters & operator=(const Parameters &params)
TERPEXPORT
#define TERPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:139
te::rp::ClassifierEDStrategyFactory::~ClassifierEDStrategyFactory
~ClassifierEDStrategyFactory()
te::rp::ClassifierEDStrategy::Parameters::ClassIDT
unsigned int ClassIDT
Class ID type definition (zero means invalid ID).
Definition: ClassifierEDStrategy.h:63
te::rp::ClassifierEDStrategy::Parameters::ClassSampleT
std::vector< double > ClassSampleT
Class sample type definition.
Definition: ClassifierEDStrategy.h:65
te::rp::ClassifierEDStrategy::Parameters::MClassesSamplesCTPtr
boost::shared_ptr< MClassesSamplesCT > MClassesSamplesCTPtr
A shared pointer to a multi classes samples container type definition.
Definition: ClassifierEDStrategy.h:71
te::rp::ClassifierStrategyFactory
Raster classifier strategy factory base class.
Definition: ClassifierStrategyFactory.h:47
Config.h
Proxy configuration file for TerraView (see terraview_config.h).
te::rp::ClassifierStrategy
Raster classifier strategy base class.
Definition: ClassifierStrategy.h:49
te::rp::ClassifierEDStrategy::Parameters::MClassesSamplesCT
std::map< ClassIDT, ClassSamplesContainerT > MClassesSamplesCT
Multi-classes samples container type definition.
Definition: ClassifierEDStrategy.h:69
te::rp::ClassifierEDStrategy::Parameters::reset
void reset() _NOEXCEPT_OP(false)
Clear all internal allocated resources and reset the parameters instance to its initial state.
ClassifierStrategyFactory.h
Raster classifier strategy factory base class.