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"
32 #include "Config.h"
33 
34 // STL
35 #include <map>
36 
37 // Boost
38 #include <boost/numeric/ublas/matrix.hpp>
39 
40 namespace te
41 {
42  namespace rp
43  {
44  /*!
45  \class MixtureModelLinearStrategy
46 
47  \ingroup rp_class
48 
49  \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.
50  */
52  {
53  public:
54 
55  /*!
56  \class Parameters
57 
58  \brief MixtureModel Parameters
59  */
61  {
62  public:
63 
65 
67 
68  //overload
69  const Parameters& operator=(const Parameters& params);
70 
71  //overload
72  void reset() throw( te::rp::Exception );
73 
74  //overload
75  AbstractParameters* clone() const;
76  };
77 
78  public:
79 
81 
83 
84  //overload
85  bool initialize(StrategyParameters const* const strategyParams) throw(te::rp::Exception);
86 
87  //overload
88  bool execute(const te::rst::Raster& inputRaster, const std::vector<unsigned int>& inputRasterBands,
89  const std::vector<std::string>& inputSensorBands, const std::map<std::string, std::vector<double> >& components,
90  std::vector<te::rst::Raster*>& outputRaster, const bool normalize, const bool enableProgressInterface) throw(te::rp::Exception);
91 
92  //overload
93  bool getTransformMatrix(boost::numeric::ublas::matrix<double>& matrix) const;
94 
95  //overload
96  bool setTransformMatrix(boost::numeric::ublas::matrix<double>& matrix) ;
97 
98  //overload
99  bool generateTransformMatrix(const std::vector<unsigned int>& inputRasterBands, const std::vector<std::string>& inputSensorBands,
100  const std::map<std::string, std::vector<double> >& components);
101 
102  //overload
103  bool getMinMax(std::vector<double>&, std::vector<double>&) const;
104  bool getMinMaxError(std::vector<double>&, std::vector<double>&) const;
105 
106  protected:
107 
108  bool m_isInitialized; //!< True if this instance is initialized.
109  MixtureModelLinearStrategy::Parameters m_parameters; //!< Internal execution parameters.
110  boost::numeric::ublas::matrix<double> m_transfMatrix; //! Transformation matrix;
111  boost::numeric::ublas::matrix<double> m_transposeA; //! Transpose of A (A is the set of known reflectances for each component);
112  std::vector<double> m_min; //!< Minimun value
113  std::vector<double> m_max; //!< Maximum value
114  std::vector<double> m_minerror; //!< Minimun error value
115  std::vector<double> m_maxerror; //!< Maximum error value
116  };
117 
118  /*!
119  \class MixtureModelLinearStrategyFactory
120 
121  \brief Raster linear mixture model strategy factory.
122 
123  \note Factory key: RegionGrowing
124  */
126  {
127  public:
128 
130 
132 
133  //overload
135  };
136 
137  } // end namespace rp
138 } // end namespace te
139 
140 #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:126
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::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:61
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.
te::rp::MixtureModelLinearStrategy
Definition: MixtureModelLinearStrategy.h:52