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