MixtureModelLinearStrategy.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/MixtureModelLinearStrategy.h
22 
23  \brief Raster linear strategy for mixture model classification.
24  */
25 
26 #ifndef __TERRALIB_RP_INTERNAL_MIXTUREMODELLINEARSTRATEGY_H
27 #define __TERRALIB_RP_INTERNAL_MIXTUREMODELLINEARSTRATEGY_H
28 
29 // TerraLib
30 #include "MixtureModelStrategy.h"
33 #include "Config.h"
34 
35 // STL
36 #include <map>
37 
38 // Boost
39 #include <boost/numeric/ublas/matrix.hpp>
40 
41 namespace te
42 {
43  namespace rp
44  {
45  /*!
46  \class MixtureModelLinearStrategy
47 
48  \ingroup rp_class
49 
50  \note The transformation matrix (A) returned by getTransformMatrix by definition: A * X = R, we have A, so that X = inv(A' * A) * A' * R where A is the set of known reflectances for each component, R is the reflectances of a specific pixel and X is the proportion of each component.
51 
52  \note Reference: Modelo Linear de Mistura Espectral Conceitos Teóricos, Algoritmos e Aplicações em Estudos na Amazônia Legal Linear Spectral Mixing Model, Theoretical Concepts, Algorithms and Applications in Studies in the Legal Amazon, Yosio Edemir Shimabukuro , Andeise Cerqueira Dutra e Egidio Arai.
53 
54  \note Reference: Utilização de atributos derivados de proporções de classes dentro de um elemento de resolução de imagem pixel na classificação multiespectral de imagens de sensoriamento remoto, Ana Paula Dutra de Aguiar, Junho 1991.
55  */
57  {
58  public:
59 
60  /*!
61  \class Parameters
62 
63  \brief MixtureModel Parameters
64  */
66  {
67  public:
68 
69  /*!
70  \enum Linear method type.
71  */
73  {
74  InvalidMethodT, //!< Invalid type
75  LST, //!< Least Square Method.
76  RLS3T //!< Resticted Least Square Method (only 3 components, 4 bands).
77  };
78 
80 
82 
84 
85  //overload
86  const Parameters& operator=(const Parameters& params);
87 
88  //overload
89  void reset() throw( te::rp::Exception );
90 
91  //overload
92  te::common::AbstractParameters* clone() const;
93  };
94 
95  public:
96 
98 
100 
101  //overload
102  bool initialize(StrategyParameters const* const strategyParams) throw(te::rp::Exception);
103 
104  //overload
105  bool execute(const te::rst::Raster& inputRaster, const std::vector<unsigned int>& inputRasterBands,
106  const std::vector<std::string>& inputSensorBands, const std::map<std::string, std::vector<double> >& components,
107  std::vector<te::rst::Raster*>& outputRaster, const bool normalize, const bool enableProgressInterface) throw(te::rp::Exception);
108 
109  //overload
110  bool getTransformMatrix(boost::numeric::ublas::matrix<double>& matrix) const;
111 
112  //overload
113  bool setTransformMatrix(boost::numeric::ublas::matrix<double>& matrix) ;
114 
115  //overload
116  bool generateTransformMatrix(
117  const std::vector<unsigned int>& inputRasterBands,
118  const std::vector<std::string>& inputSensorBands,
119  const std::map<std::string, std::vector<double> >& components );
120 
121  //overload
122  bool getMinMax(std::vector<double>&, std::vector<double>&) const;
123  bool getMinMaxError(std::vector<double>&, std::vector<double>&) const;
124 
125  protected:
126 
127  bool m_isInitialized; //!< True if this instance is initialized.
128  MixtureModelLinearStrategy::Parameters m_parameters; //!< Internal execution parameters.
129  boost::numeric::ublas::matrix<double> m_AMatrix; //! A matrix.
130  std::vector<double> m_min; //!< Minimun value
131  std::vector<double> m_max; //!< Maximum value
132  std::vector<double> m_minerror; //!< Minimun error value
133  std::vector<double> m_maxerror; //!< Maximum error value
134 
135  bool executeRLS3T(
136  const te::rst::Raster& inputRaster,
137  const std::vector<unsigned int>& inputRasterBands,
138  const std::vector<std::string>& inputSensorBands,
139  const std::map<std::string, std::vector<double> >& components,
140  std::vector<te::rst::Raster*>& outputRaster, const bool normalize, const bool enableProgressInterface) throw(te::rp::Exception);
141 
142  bool executeLST(
143  const te::rst::Raster& inputRaster,
144  const std::vector<unsigned int>& inputRasterBands,
145  const std::vector<std::string>& inputSensorBands,
146  const std::map<std::string, std::vector<double> >& components,
147  std::vector<te::rst::Raster*>& outputRaster, const bool normalize, const bool enableProgressInterface) throw(te::rp::Exception);
148 
149  };
150 
151  /*!
152  \class MixtureModelLinearStrategyFactory
153 
154  \brief Raster linear mixture model strategy factory.
155 
156  \note Factory key: RegionGrowing
157  */
159  {
160  public:
161 
163 
165 
166  //overload
168  };
169 
170  } // end namespace rp
171 } // end namespace te
172 
173 #endif // __TERRALIB_RP_INTERNAL_MIXTUREMODELLINEARSTRATEGY_H
te::rp::MixtureModelLinearStrategy::Parameters::Parameters
Parameters()
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::rp::MixtureModelLinearStrategyFactory
Raster linear mixture model strategy factory.
Definition: MixtureModelLinearStrategy.h:159
te::rp::MixtureModelStrategyParameters
Mixture model strategy parameters base class.
Definition: MixtureModelStrategyParameters.h:37
te::rp::MixtureModelLinearStrategy::Parameters::MethodType
MethodType
Definition: MixtureModelLinearStrategy.h:73
te::rp::MixtureModelLinearStrategyFactory::~MixtureModelLinearStrategyFactory
~MixtureModelLinearStrategyFactory()
te::rp::MixtureModelLinearStrategy::Parameters::~Parameters
~Parameters()
boost
Definition: Translator.h:43
te::rp::MixtureModelLinearStrategy::Parameters::reset
void reset()
Clear all internal allocated resources and reset the parameters instance to its initial state.
MixtureModelStrategy.h
Raster mixture model strategy base class.
te::rp::MixtureModelLinearStrategy::Parameters::InvalidMethodT
@ InvalidMethodT
Invalid type.
Definition: MixtureModelLinearStrategy.h:74
te::rp::MixtureModelLinearStrategy::Parameters::LST
@ LST
Least Square Method.
Definition: MixtureModelLinearStrategy.h:75
te::Exception
Base exception class for plugin module.
Definition: Exception.h:42
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::MixtureModelLinearStrategyFactory::build
te::rp::MixtureModelStrategy * build()
Concrete factories (derived from this one) must implement this method in order to create objects.
te::rp::MixtureModelLinearStrategy::Parameters::operator=
const Parameters & operator=(const Parameters &params)
te::rp::StrategyParameters
Raster strategy parameters base class.
Definition: StrategyParameters.h:43
te::rp::MixtureModelStrategy
Raster mixture model strategy base class.
Definition: MixtureModelStrategy.h:50
te::rp::MixtureModelLinearStrategy::Parameters
MixtureModel Parameters.
Definition: MixtureModelLinearStrategy.h:66
te::rp::MixtureModelLinearStrategy::Parameters::m_methodType
MethodType m_methodType
Definition: MixtureModelLinearStrategy.h:79
te::rp::MixtureModelLinearStrategyFactory::MixtureModelLinearStrategyFactory
MixtureModelLinearStrategyFactory()
te::rp::MixtureModelStrategyFactory
Raster Mixture model strategy factory base class.
Definition: MixtureModelStrategyFactory.h:47
te::mnt::getMinMax
TEMNTEXPORT void getMinMax(te::rst::Raster *inputRst, double &vmin, double &vmax)
Config.h
Proxy configuration file for TerraView (see terraview_config.h).
MixtureModelStrategyFactory.h
Raster mixture model strategy factory base class.
MixtureModelStrategyParameters.h
te::rp::MixtureModelLinearStrategy
Definition: MixtureModelLinearStrategy.h:57