Loading...
Searching...
No Matches
MixtureModelStrategy.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/MixtureModelStrategy.h
22
23 \brief Raster mixture model strategy base class.
24 */
25
26#ifndef __TERRALIB_RP_INTERNAL_MIXTUREMODELSTRATEGY_H
27#define __TERRALIB_RP_INTERNAL_MIXTUREMODELSTRATEGY_H
28
29// TerraLib
30#include "../raster/Raster.h"
31#include "StrategyParameters.h"
32#include "Config.h"
33#include "Exception.h"
34
35// STL
36#include <vector>
37
38// Boost
39#include <boost/numeric/ublas/matrix.hpp>
40
41namespace te
42{
43 namespace rp
44 {
45 /*!
46 \class MixtureModelStrategy
47 \brief Raster mixture model strategy base class.
48 */
50 {
51 public:
52
53 /*! \brief Virtual destructor. */
55
56 /*!
57 \brief Initialize the segmentation strategy.
58 \param strategyParams A pointer to the user given specific segmentation strategy parameters ou NULL if no parameters are present.
59 \return true if OK, false on errors.
60 */
61 virtual bool initialize(StrategyParameters const* const strategyParams) = 0;
62
63 /*!
64 \brief Executes the segmentation strategy.
65
66 \param inputRaster Input raster.
67 \param inputRasterBands Input raster bands.
68 \param components The set of endmembers and its radiances.
69 \param outputRaster Output raster vector, contains output raster and error raster if requested.
70 \param enableProgressInterface Enable the internal strategy to update the progress interface.
71
72 \return true if OK, false on errors.
73 */
74 virtual bool execute(const te::rst::Raster& inputRaster, const std::vector<unsigned int>& inputRasterBands,
75 const std::vector<std::string>& inputSensorBands, const std::map<std::string, std::vector<double> >& components,
76 std::vector<te::rst::Raster*>& outputRaster, const bool normalize, const bool enableProgressInterface) = 0;
77
78 /*!
79 \brief Returns the used transformation matrix (when applicable).
80 \param matrix The transformation matrix.
81 \return true if OK, false on errors or not applicable cases.
82 */
83 virtual bool getTransformMatrix( boost::numeric::ublas::matrix<double>& matrix ) const = 0;
84
85 /*!
86 \brief Sets the used transformation matrix.
87 \param matrix The transformation matrix.
88 \return true if OK, false on errors or not applicable cases.
89 */
90 virtual bool setTransformMatrix(boost::numeric::ublas::matrix<double>& matrix) = 0;
91
92 /*!
93 \brief Generates the used transformation matrix (when applicable).
94 \param inputRasterBands Input raster bands.
95 \param inputSensorBands Input names of the sensor/bands.
96 \param components A set of endmembers and its radiances.
97 \return true if OK, false on errors or not applicable cases.
98 */
99 virtual bool generateTransformMatrix(const std::vector<unsigned int>& inputRasterBands, const std::vector<std::string>& inputSensorBands,
100 const std::map<std::string, std::vector<double> >& components) = 0;
101
102 virtual bool getMinMax(std::vector<double>&, std::vector<double>&) const = 0;
103 virtual bool getMinMaxError(std::vector<double>&, std::vector<double>&) const = 0;
104
105 /*!
106 \brief Return the current error message if there is any.
107
108 \return Return the current error message if there is any.
109 */
110 const std::string& getErrorMessage() const;
111
112 protected:
113
114 /*! \brief Default constructor. */
116
117 /*!
118 \brief Set the current error message.
119
120 \param newErrorMessage New error message;
121 */
122 void setErrorMessage( const std::string& newErrorMessage );
123
124 /*!
125 \brief Reset to an initial state
126 */
127 virtual void reset();
128
129 private:
130
131 /*!
132 \brief Current error message.
133 */
134 std::string m_errorMessage;
135
136 /*!
137 \brief Copy constructor.
138
139 \param rhs The right-hand side Raster.
140 */
142
143 /*!
144 \brief Assignment operator.
145
146 \param rhs The right-hand-side copy that would be used to copy from.
147
148 \return A reference to this object.
149 */
151
152
153 };
154
155 } // end namespace rp
156} // end namespace te
157
158#endif // __TERRALIB_RP_INTERNAL_MIXTUREMODELSTRATEGY_H
159
Raster strategy parameters base class.
Raster mixture model strategy base class.
std::string m_errorMessage
Current error message.
virtual bool generateTransformMatrix(const std::vector< unsigned int > &inputRasterBands, const std::vector< std::string > &inputSensorBands, const std::map< std::string, std::vector< double > > &components)=0
Generates the used transformation matrix (when applicable).
const std::string & getErrorMessage() const
Return the current error message if there is any.
virtual ~MixtureModelStrategy()
Virtual destructor.
virtual 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)=0
Executes the segmentation strategy.
MixtureModelStrategy & operator=(const MixtureModelStrategy &rhs)
Assignment operator.
virtual bool getTransformMatrix(boost::numeric::ublas::matrix< double > &matrix) const =0
Returns the used transformation matrix (when applicable).
virtual void reset()
Reset to an initial state.
virtual bool setTransformMatrix(boost::numeric::ublas::matrix< double > &matrix)=0
Sets the used transformation matrix.
void setErrorMessage(const std::string &newErrorMessage)
Set the current error message.
virtual bool initialize(StrategyParameters const *const strategyParams)=0
Initialize the segmentation strategy.
virtual bool getMinMax(std::vector< double > &, std::vector< double > &) const =0
virtual bool getMinMaxError(std::vector< double > &, std::vector< double > &) const =0
MixtureModelStrategy()
Default constructor.
MixtureModelStrategy(const MixtureModelStrategy &rhs)
Copy constructor.
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).
An exception class for the XML module.