Loading...
Searching...
No Matches
MixtureModelWizardPage.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/qt/widgets/rp/MixtureModelWizardPage.h
22
23 \brief This file defines a class for a MixtureModel Wizard page.
24
25 /brief JSON File Structure used to save the mix model components information
26
27 {
28 "Band_Sensors":{
29 [
30 "Band": {
31 "band": "****",
32 "use": "****",
33 "sensor": "****"
34 },
35 .
36 .
37 .
38 "Band": {
39 "band": "****",
40 "use": "****",
41 "sensor": "****"
42 },
43 ]
44 },
45
46 "MixModel_Components":{
47 [
48 "Component": {
49 "name": "****",
50 "coordGrid": {
51 "xGrid": "****",
52 "yGrid": "****"
53 },
54 "coordGeo": {
55 "xGeo": "****",
56 "yGeo": "****"
57 },
58 "Color": "****"
59 },
60 .
61 .
62 .
63 "Component": {
64 "name": "****",
65 "coordGrid": {
66 "xGrid": "****",
67 "yGrid": "****"
68 },
69 "coordGeo": {
70 "xGeo": "****",
71 "yGeo": "****"
72 },
73 "Color":"****"
74 },
75 ]
76 },
77
78 "Mixture Model": {
79 "Method": "****"
80 },
81
82 "Transform Matrix": [
83 [
84 "****",
85 .
86 .
87 .
88 "****"
89 ],
90 .
91 .
92 .
93 [
94 "****",
95 .
96 .
97 .
98 "****"
99 ]
100 ]
101 }
102
103
104 struct MixModelComponent
105 {
106 std::string m_name;
107 te::gm::Geometry* m_geomGrid;
108 te::gm::Geometry* m_geomGeo;
109 std::vector<double> m_values;
110 te::color::RGBAColor m_color;
111 };
112*/
113
114#ifndef __TERRALIB_QT_WIDGETS_RP_INTERNAL_MIXTUREMODELWIZARDPAGE_H
115#define __TERRALIB_QT_WIDGETS_RP_INTERNAL_MIXTUREMODELWIZARDPAGE_H
116
117// TerraLib
118#include "../../../classification/ROISet.h"
119#include "../../../color/RGBAColor.h"
120#include "../../../geometry/Geometry.h"
121#ifndef Q_MOC_RUN
122#include "../../../maptools/AbstractLayer.h"
123#include "../../../qt/widgets/canvas/MapDisplay.h"
124#include "../../../qt/widgets/charts/ChartDisplay.h"
125#include "../../../qt/widgets/charts/ChartDisplayWidget.h"
126#include "../../../qt/widgets/charts/ChartStyle.h"
127#include "../../../raster/Raster.h"
128#include "../../../rp/Functions.h"
129#include "../../../rp/MixtureModel.h"
130#endif
131#include "../Config.h"
132
133
134// STL
135#include <memory>
136
137// Qt
138#include <QWizardPage>
139#include <QTableWidget>
140#include <QActionGroup>
141#include <qgridlayout.h>
142#include <QSignalMapper>
143#include <QTreeWidget>
144#include <QTreeWidgetItem>
145
146//QWT
147#include <qwt_plot_curve.h>
148
149// Forward declaration
150namespace Ui { class MixtureModelWizardPageForm; }
151
152namespace te
153{
154 namespace se { class Mark; }
155
156 namespace qt
157 {
158 namespace widgets
159 {
160 class RpToolsWidget;
161 class SensorManagerDialog;
162 class ROIManagerDialog;
163
164 /*!
165 \class MixtureModelWizardPage
166
167 \brief This class is GUI used to define the mixture model parameters for the RP constast operation.
168 */
169 class TEQTWIDGETSEXPORT MixtureModelWizardPage : public QWizardPage
170 {
171 Q_OBJECT
172
173 //!\enum MixModelTypes
174 //!\brief Available Algorithms for Mixture Model
176 {
177 MIXMODEL_LINEAR, //!< Linear (Least Square Method).
178 MIXMODEL_PCA, //!< Principal Components Mixture Model.
179 MIXMODEL_LINEAR_RLS3T //!< Linear (Resticted Least Square Method (only 3 components, 4 bands).
180 };
181
182 //!\struct MixModelComponent
183 //!\brief Defines component attributes
185 {
186 std::string m_name; //!< name
187 te::gm::Geometry *m_geomGrid; //!< component coordinades in raster lineXcolumn
188 te::gm::Geometry *m_geomGeo; //!< component coordinates in geografic coordinates
189 std::vector<double> m_values; //!< raster values
191 };
192
193 public:
194
195 MixtureModelWizardPage(QWidget* parent = 0);
196
198
199 bool isComplete() const;
200
201 public:
202
203 /*!
204 \brief This method is used to set the selected layer for mixture model operation
205 \param layer The layer ptr
206 \note This layer MUST HAVE a valid raster object.
207 */
208 void set(std::list<te::map::AbstractLayerPtr> layers);
209
211
212 void setActionGroup(QActionGroup* actionGroup);
213
214 std::list<te::map::AbstractLayerPtr> get();
215
217
219
221
223
224 void loadMixtureModelComponents(const std::string &fileName);
225
227
229
231
232 boost::numeric::ublas::matrix<double> getTransfMatrix() {
233 return m_transfMatrix;
234 }
235
237
238 public slots:
239
241
243
245
247
248 void onPointPicked(double x, double y);
249
251
253
255
256 void onComponentItemClicked(QTreeWidgetItem * item, int column);
260 void onallEnabled(bool);
261
262 void drawGeom();
263
266
267 void showROIManager(bool show);
268
270
271 protected:
272
274
275 void listBands();
276
277 void drawMarks();
278
280
281 double GetMediumWavelength(std::string sensor);
282
286
287 void printTransMatrix() const;
288
289 private:
290 std::unique_ptr<Ui::MixtureModelWizardPageForm> m_ui;
291
292 QSignalMapper m_ButtonSignalMapper;
293
294 te::qt::widgets::SensorManagerDialog *m_sensorManagerDialog; //!< Dialog to select/edit spectral sensors
295 std::map<std::string, te::rp::SpectralSensorParams > m_SensorParams; //!< map with sensor parameters
296
297 std::unique_ptr<te::qt::widgets::RpToolsWidget> m_navigator;
298 std::unique_ptr<te::qt::widgets::ROIManagerDialog> m_roiMngDlg;
299
301
302 std::map<std::string, MixModelComponent > m_components; //!< The map of selected components
303 unsigned int m_countComponents; //!< The maximum number of components inserted.
304
305 std::list<te::map::AbstractLayerPtr> m_layers; //!< list of input layers
306 std::vector<double> m_maxValue; //!< vector to store maximum value of each band
307 te::color::RGBAColor** m_rgbaMark; //!< component color
308 te::se::Mark* m_mark; //!< component point mark type
309
311
313 QGridLayout* m_layoutg;
314 QColor m_color; //!< Current component color
315 te::gm::Geometry* m_geom; //!< Current geometry/envelope component
316 std::string m_comp; //!< Current component
317
318 std::string m_json_out; //!< Json filename to save components
319 boost::numeric::ublas::matrix<double> m_transfMatrix; //!< Transformation matrix;
320 int m_type; //!< algorithm mixture model type (MIXMODEL_LINEAR or MIXMODEL_PCA)
321
323 };
324
325 } // end namespace widgets
326 } // end namespace qt
327} // end namespace te
328
329#endif // __TERRALIB_QT_WIDGETS_RP_INTERNAL_MIXTUREMODELWIZARDPAGE_H
A ROISet is a set of ROI's.
Definition: ROISet.h:54
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
Definition: RGBAColor.h:58
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:52
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:78
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
Definition: Polygon.h:51
A wdiget used to display a chart.
A widget to control the display of a set of layers.
Definition: MapDisplay.h:72
This class is GUI used to define the mixture model parameters for the RP constast operation.
void loadMixtureModelComponents(const std::string &fileName)
std::vector< double > m_maxValue
vector to store maximum value of each band
void set(std::list< te::map::AbstractLayerPtr > layers)
This method is used to set the selected layer for mixture model operation.
std::list< te::map::AbstractLayerPtr > m_layers
list of input layers
te::color::RGBAColor ** m_rgbaMark
component color
void onEnvelopeAcquired(te::gm::Envelope env)
void onGeomAquired(te::gm::Polygon *poly)
std::string m_json_out
Json filename to save components.
void setActionGroup(QActionGroup *actionGroup)
te::rp::MixtureModel::InputParameters getInputParams()
std::map< std::string, te::rp::SpectralSensorParams > m_SensorParams
map with sensor parameters
te::qt::widgets::SensorManagerDialog * m_sensorManagerDialog
Dialog to select/edit spectral sensors.
te::gm::Geometry * m_geom
Current geometry/envelope component.
MixModelTypes
Available Algorithms for Mixture Model.
@ MIXMODEL_LINEAR
Linear (Least Square Method).
@ MIXMODEL_PCA
Principal Components Mixture Model.
boost::numeric::ublas::matrix< double > getTransfMatrix()
void onPointPicked(double x, double y)
void onROIManagerClosed(te::cl::ROISet *rs)
std::unique_ptr< te::qt::widgets::ROIManagerDialog > m_roiMngDlg
te::rp::MixtureModel::OutputParameters getOutputParams()
std::unique_ptr< te::qt::widgets::RpToolsWidget > m_navigator
boost::numeric::ublas::matrix< double > m_transfMatrix
Transformation matrix;.
te::qt::widgets::MapDisplay * m_mapDisplay
int m_type
algorithm mixture model type (MIXMODEL_LINEAR or MIXMODEL_PCA)
void onComponentItemClicked(QTreeWidgetItem *item, int column)
void setMapDisplay(te::qt::widgets::MapDisplay *mapDisplay)
std::unique_ptr< Ui::MixtureModelWizardPageForm > m_ui
std::map< std::string, MixModelComponent > m_components
The map of selected components.
te::qt::widgets::ChartDisplayWidget * m_displayWidget
te::se::Mark * m_mark
component point mark type
std::list< te::map::AbstractLayerPtr > get()
double GetMediumWavelength(std::string sensor)
unsigned int m_countComponents
The maximum number of components inserted.
A dialog used to build a SensorManagerDialog element.
MixtureModel input parameters.
Definition: MixtureModel.h:73
MixtureModel output parameters.
Definition: MixtureModel.h:131
A Mark specifies a geometric shape and applies coloring to it.
Definition: Mark.h:85
TerraLib.
#define slots
te::gm::Geometry * m_geomGeo
component coordinates in geografic coordinates
te::gm::Geometry * m_geomGrid
component coordinades in raster lineXcolumn
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63