Classifier.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  \file terralib/rp/Classifier.h
21 
22  \brief Raster classification.
23  */
24 
25 #ifndef __TERRALIB_RP_INTERNAL_CLASSIFIER_H
26 #define __TERRALIB_RP_INTERNAL_CLASSIFIER_H
27 
28 // TerraLib
29 #include "Algorithm.h"
30 #include "Config.h"
31 #include "Matrix.h"
33 
34 #include <map>
35 
36 namespace te
37 {
38  namespace rst
39  {
40  class Raster;
41  class Band;
42  }
43 
44  namespace gm
45  {
46  class Polygon;
47  }
48 
49  namespace rp
50  {
51  /*!
52  \class Classifier
53 
54  \brief Raster classification.
55 
56  \details Raster classification following the choosed strategy.
57 
58  \note The created label image will be written to the raster instance
59  pointed by m_outRasterPtr (in this case the output band must also be
60  passed by m_outRasterBand).
61 
62  \ingroup rp_class
63  */
65  {
66  public:
67 
68  /*!
69  \class InputParameters
70 
71  \brief Classifier input parameters
72  */
73 
75  {
76  public:
77 
78  /*! \brief Default constructor. */
80 
81  /*!
82  \brief Copy constructor.
83 
84  \param rhs The right-hand side Raster.
85  */
86  InputParameters(const InputParameters& rhs);
87 
88  ~InputParameters();
89 
90  /*!
91  \brief Set specific classifier strategy parameters.
92 
93  \param p The specific classifier strategy parameters.
94  */
95  void setClassifierStrategyParams(const ClassifierStrategyParameters& p);
96 
97  /*!
98  \brief Returns a pointer to the internal specific classifier strategy parameters, or null if no parameters are present.
99  */
100  ClassifierStrategyParameters const* getClassifierStrategyParams() const;
101 
102  //overload
103  void reset() throw(te::rp::Exception);
104 
105  //overload
106  const Classifier::InputParameters& operator=(const Classifier::InputParameters& params);
107 
108  //overload
109  te::common::AbstractParameters* clone() const;
110 
111  public:
112 
113  te::rst::Raster const* m_inputRasterPtr; //!< Input raster.
114  std::vector<unsigned int> m_inputRasterBands; //!< Bands to be processed from the input raster.
115  std::vector<te::gm::Polygon*> m_inputPolygons; //!< The polygons to be classified when using object-based image analysis (OBIA).
116  std::string m_strategyName; //!< The classifier strategy name see each te::rp::ClassifierStrategyFactory inherited classes documentation for reference.
117  ClassifierStrategyParameters* m_classifierStrategyParamsPtr; //!< Internal specific classifier strategy parameters.
118 
119  };
120 
121  /*!
122  \class OutputParameters
123 
124  \brief Classifier output parameters
125  */
126 
128  {
129  public:
130 
131  /*! \brief Default constructor. */
133 
134  /*!
135  \brief Copy constructor.
136 
137  \param rhs The right-hand side Raster.
138  */
140 
141  ~OutputParameters();
142 
143  //overload
144  void reset() throw(te::rp::Exception);
145 
146  //overload
147  const Classifier::OutputParameters& operator=(const Classifier::OutputParameters& params);
148 
149  //overload
150  te::common::AbstractParameters* clone() const;
151 
152  public:
153 
154  std::string m_rType; //!< Output raster data source type (as described in te::raster::RasterFactory ).
155  std::map< std::string, std::string > m_rInfo; //!< The necessary information to create the raster (as described in te::raster::RasterFactory).
156  mutable std::auto_ptr<te::rst::Raster> m_outputRasterPtr; //!< A pointer to the generated output raster (label image).
157  std::map< std::string, std::string > m_metadados;
158  };
159 
160  Classifier();
161 
162  ~Classifier();
163 
164  //overload
165  bool execute(AlgorithmOutputParameters& outputParams) throw(te::rp::Exception);
166 
167  //overload
168  void reset() throw(te::rp::Exception);
169 
170  //overload
171  bool initialize(const AlgorithmInputParameters& inputParams) throw(te::rp::Exception);
172 
173  bool isInitialized() const;
174 
175  protected :
176 
177  bool m_instanceInitialized; //!< Is this instance already initialized?
178  Classifier::InputParameters m_inputParameters; //!< Classifier execution parameters.
179  };
180 
181  } // end namespace rp
182 } // end namespace te
183 
184 #endif
std::vector< te::gm::Polygon * > m_inputPolygons
The polygons to be classified when using object-based image analysis (OBIA).
Definition: Classifier.h:115
Raster classification.
Definition: Classifier.h:64
te::rst::Raster const * m_inputRasterPtr
Input raster.
Definition: Classifier.h:113
std::auto_ptr< te::rst::Raster > m_outputRasterPtr
A pointer to the generated output raster (label image).
Definition: Classifier.h:156
std::string m_strategyName
The classifier strategy name see each te::rp::ClassifierStrategyFactory inherited classes documentati...
Definition: Classifier.h:116
Base exception class for plugin module.
Definition: Exception.h:42
Raster Processing algorithm output parameters base interface.
Raster Processing algorithm base interface class.
Classifier output parameters.
Definition: Classifier.h:127
Raster classifier strategy parameters base class.
Raster Processing algorithm base interface.
Definition: Algorithm.h:41
An abstract class for raster data strucutures.
Definition: Raster.h:71
URI C++ Library.
#define TERPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:139
std::vector< unsigned int > m_inputRasterBands
Bands to be processed from the input raster.
Definition: Classifier.h:114
Generic template matrix.
Abstract parameters base interface.
Configuration flags for the Raster Processing module of TerraLib.
std::map< std::string, std::string > m_metadados
Definition: Classifier.h:157
Raster Processing algorithm input parameters base interface.
std::map< std::string, std::string > m_rInfo
The necessary information to create the raster (as described in te::raster::RasterFactory).
Definition: Classifier.h:155
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
Definition: Classifier.h:154
ClassifierStrategyParameters * m_classifierStrategyParamsPtr
Internal specific classifier strategy parameters.
Definition: Classifier.h:117
Classifier input parameters.
Definition: Classifier.h:74