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() ;
90 
91  //overload
93 
94  //overload
95  bool serialize ( AlgorithmParametersSerializer& serializer ) const;
96  };
97 
98  public:
99 
101 
103 
104  //overload
105  bool initialize(StrategyParameters const* const strategyParams) ;
106 
107  //overload
108  bool execute(const te::rst::Raster& inputRaster, const std::vector<unsigned int>& inputRasterBands,
109  const std::vector<std::string>& inputSensorBands, const std::map<std::string, std::vector<double> >& components,
110  std::vector<te::rst::Raster*>& outputRaster, const bool normalize, const bool enableProgressInterface) ;
111 
112  //overload
113  bool getTransformMatrix(boost::numeric::ublas::matrix<double>& matrix) const;
114 
115  //overload
116  bool setTransformMatrix(boost::numeric::ublas::matrix<double>& matrix) ;
117 
118  //overload
120  const std::vector<unsigned int>& inputRasterBands,
121  const std::vector<std::string>& inputSensorBands,
122  const std::map<std::string, std::vector<double> >& components );
123 
124  //overload
125  bool getMinMax(std::vector<double>&, std::vector<double>&) const;
126  bool getMinMaxError(std::vector<double>&, std::vector<double>&) const;
127 
128  protected:
129 
130  bool m_isInitialized; //!< True if this instance is initialized.
131  MixtureModelLinearStrategy::Parameters m_parameters; //!< Internal execution parameters.
132  boost::numeric::ublas::matrix<double> m_AMatrix; //! A matrix.
133  std::vector<double> m_min; //!< Minimun value
134  std::vector<double> m_max; //!< Maximum value
135  std::vector<double> m_minerror; //!< Minimun error value
136  std::vector<double> m_maxerror; //!< Maximum error value
137 
139  const te::rst::Raster& inputRaster,
140  const std::vector<unsigned int>& inputRasterBands,
141  const std::vector<std::string>& inputSensorBands,
142  const std::map<std::string, std::vector<double> >& components,
143  std::vector<te::rst::Raster*>& outputRaster, const bool normalize, const bool enableProgressInterface) ;
144 
146  const te::rst::Raster& inputRaster,
147  const std::vector<unsigned int>& inputRasterBands,
148  const std::vector<std::string>& inputSensorBands,
149  const std::map<std::string, std::vector<double> >& components,
150  std::vector<te::rst::Raster*>& outputRaster, const bool normalize, const bool enableProgressInterface) ;
151 
152  };
153 
154  /*!
155  \class MixtureModelLinearStrategyFactory
156 
157  \brief Raster linear mixture model strategy factory.
158 
159  \note Factory key: RegionGrowing
160  */
162  {
163  public:
164 
166 
168 
169  //overload
171  };
172 
173  } // end namespace rp
174 } // end namespace te
175 
176 #endif // __TERRALIB_RP_INTERNAL_MIXTUREMODELLINEARSTRATEGY_H
Raster mixture model strategy factory base class.
Raster mixture model strategy base class.
Abstract parameters base interface.
A class to standardize algorithm parameters serialization.
Raster linear mixture model strategy factory.
te::rp::MixtureModelStrategy * build()
Concrete factories (derived from this one) must implement this method in order to create objects.
bool serialize(AlgorithmParametersSerializer &serializer) const
Returns a parameter serialization object.
void reset()
Clear all internal allocated resources and reset the parameters instance to its initial state.
const Parameters & operator=(const Parameters &params)
te::common::AbstractParameters * clone() const
Create a clone copy of this instance.
bool setTransformMatrix(boost::numeric::ublas::matrix< double > &matrix)
Sets the used transformation matrix.
MixtureModelLinearStrategy::Parameters m_parameters
Internal execution parameters.
boost::numeric::ublas::matrix< double > m_AMatrix
std::vector< double > m_max
Maximum value.
bool executeRLS3T(const te::rst::Raster &inputRaster, const std::vector< unsigned int > &inputRasterBands, const std::vector< std::string > &inputSensorBands, const std::map< std::string, std::vector< double > > &components, std::vector< te::rst::Raster * > &outputRaster, const bool normalize, const bool enableProgressInterface)
std::vector< double > m_maxerror
Maximum error value.
bool generateTransformMatrix(const std::vector< unsigned int > &inputRasterBands, const std::vector< std::string > &inputSensorBands, const std::map< std::string, std::vector< double > > &components)
Generates the used transformation matrix (when applicable).
bool getMinMax(std::vector< double > &, std::vector< double > &) const
bool getTransformMatrix(boost::numeric::ublas::matrix< double > &matrix) const
Returns the used transformation matrix (when applicable).
bool getMinMaxError(std::vector< double > &, std::vector< double > &) const
bool initialize(StrategyParameters const *const strategyParams)
Initialize the segmentation strategy.
bool m_isInitialized
True if this instance is initialized.
bool executeLST(const te::rst::Raster &inputRaster, const std::vector< unsigned int > &inputRasterBands, const std::vector< std::string > &inputSensorBands, const std::map< std::string, std::vector< double > > &components, std::vector< te::rst::Raster * > &outputRaster, const bool normalize, const bool enableProgressInterface)
bool execute(const te::rst::Raster &inputRaster, const std::vector< unsigned int > &inputRasterBands, const std::vector< std::string > &inputSensorBands, const std::map< std::string, std::vector< double > > &components, std::vector< te::rst::Raster * > &outputRaster, const bool normalize, const bool enableProgressInterface)
Executes the segmentation strategy.
std::vector< double > m_minerror
Minimun error value.
Raster Mixture model strategy factory base class.
Mixture model strategy parameters base class.
Raster mixture model strategy base class.
Raster strategy parameters base class.
An abstract class for raster data strucutures.
Definition: Raster.h:72
TerraLib.
#define TERPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:139
Proxy configuration file for TerraView (see terraview_config.h).