RasterStatisticsWizardPage.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 #ifndef TE_QT_WIDGETS_RASTERSTATISTICSWIZARDPAGE_H
22 #define TE_QT_WIDGETS_RASTERSTATISTICSWIZARDPAGE_H
23 
24 //Terralib
25 #ifndef Q_MOC_RUN
26 #include "../../../dataaccess/datasource/DataSourceInfo.h"
27 #include "../../../maptools/AbstractLayer.h"
28 #endif
29 #include "../Config.h"
30 #include "../classification/ROIManagerDialog.h"
31 #include "../../../rp/Matrix.h"
33 
34 //Qt
35 #include <QWizardPage>
36 #include <QActionGroup>
37 
38 //STL
39 #include <memory>
40 
41 //Forward declarations
42 namespace Ui
43 {
44  class RasterStatisticsWizardPageForm;
45 }
46 
47 namespace te
48 {
49  namespace rst { class Raster; }
50 
51  namespace qt
52  {
53  namespace widgets
54  {
55 
56  class TEQTWIDGETSEXPORT RasterStatisticsWizardPage : public QWizardPage
57  {
58  Q_OBJECT
59 
60  public:
61 
62  RasterStatisticsWizardPage(QWidget* parent=0);
63 
65 
66  bool isComplete() const;
67 
68  /*!
69  \brief This method is used to set the selected layer for vectorization operation
70 
71  \param layer The layer ptr
72 
73  \note This layer MUST HAVE a valid raster object.
74  */
76 
78 
79  void setActionGroup(QActionGroup* actionGroup);
80 
81  protected:
82 
83  std::unique_ptr<Ui::RasterStatisticsWizardPageForm> m_uiStatPageForm;
84  std::unique_ptr<te::qt::widgets::ROIManagerDialog> m_roiManagerPtr;
85  std::unique_ptr<te::qt::widgets::RasterStatisticsWizardLog> m_logDialogPtr;
87 
88  /*!
89  \brief Return the current selected band indexes.
90  \param bandsIndexes Current selected band indexes.
91  */
92  void getBandIndexes( std::vector< unsigned int >& bandsIndexes ) const;
93 
94  /*!
95  \brief Return the current histograms.
96  \param realHistograms Real histograms.
97  \param imagHistograms Real histograms.
98  \note Histograms map: map key.first=ROI Ids, map_key.second=band_index.
99  \note Histograms map: map key.first="ALL_IMAGE" for the case where no ROIs are avaliable.
100  \return true if ok, false on erros.
101  */
103  std::map< std::pair< std::string, unsigned int >, std::map<double,
104  unsigned int> >& realHistograms,
105  std::map< std::pair< std::string, unsigned int >, std::map<double,
106  unsigned int> >& imagHistograms ) const;
107 
108  /*!
109  \brief Return the current joint histograms.
110  \param realHistograms Real histograms.
111  \param imagHistograms Real histograms.
112  \note Joint Histograms map key: std::tuple( 0 )=roi_id, std::tuple( 1 )=band_index_1, std::tuple( 2 )=band_index_2
113  \note Joint Histograms map key: std::tuple( 0 )="ALL_IMAGE" for the case where no ROIs are avaliable.
114  \return true if ok, false on erros.
115  */
117  const std::map< std::pair< std::string, unsigned int >, std::map<double,
118  unsigned int> >& realHistograms,
119  const std::map< std::pair< std::string, unsigned int >, std::map<double,
120  unsigned int> >& imagHistograms,
121  std::map< std::tuple< std::string, unsigned int, unsigned int >,
122  std::map< std::pair< double, double >, unsigned int> >& realJointHistograms,
123  std::map< std::tuple< std::string, unsigned int, unsigned int >,
124  std::map< std::pair< double, double >, unsigned int> >& imagJointHistograms ) const;
125 
126  /*!
127  \brief Return the covariance value.
128  \param roiID Target ROI id.
129  \param bandIdx1 Target band 1 index.
130  \param bandIdx2 Target band 2 index.
131  \param jointHistograms Joint histograms.
132  \param histograms Single band histograms.
133  \param covariance Covariance value.
134  \return true if ok, false on erros.
135  */
136  static bool getCovariance(
137  const std::string& roiID,
138  const unsigned int& bandIdx1,
139  const unsigned int& bandIdx2,
140  const std::map< std::tuple< std::string, unsigned int, unsigned int >,
141  std::map< std::pair< double, double >, unsigned int> >& jointHistograms,
142  const std::map< std::pair< std::string, unsigned int >, std::map<double,
143  unsigned int> >& histograms,
144  double& covariance );
145 
146  /*!
147  \brief Return the correlation value.
148  \param roiID Target ROI id.
149  \param bandIdx1 Target band 1 index.
150  \param bandIdx2 Target band 2 index.
151  \param jointHistograms Joint histograms.
152  \param histograms Single band histograms.
153  \param correlation Correlation value.
154  \return true if ok, false on erros.
155  */
156  static bool getCorrelation(
157  const std::string& roiID,
158  const unsigned int& bandIdx1,
159  const unsigned int& bandIdx2,
160  const std::map< std::tuple< std::string, unsigned int, unsigned int >,
161  std::map< std::pair< double, double >, unsigned int> >& jointHistograms,
162  const std::map< std::pair< std::string, unsigned int >, std::map<double,
163  unsigned int> >& histograms,
164  double& correlation );
165 
166  /*!
167  \brief Return the Kurtosis value.
168  \param roiID Target ROI id.
169  \param bandIdx1 Target band 1 index.
170  \param jointHistograms Joint histograms.
171  \param histograms Single band histograms.
172  \param kurtosis Correlation value.
173  \return true if ok, false on erros.
174  */
175  static bool getKurtosis(
176  const std::string& roiID,
177  const unsigned int& bandIdx1,
178  const std::map< std::tuple< std::string, unsigned int, unsigned int >,
179  std::map< std::pair< double, double >, unsigned int> >& jointHistograms,
180  const std::map< std::pair< std::string, unsigned int >, std::map<double,
181  unsigned int> >& histograms,
182  double& kurtosis );
183 
184  /*!
185  \brief Return the covariance matrix.
186  \param roiID Target ROI id.
187  \param jointHistograms Joint histograms.
188  \param histograms Single band histograms.
189  \param matrix Output matrix.
190  \return true if ok, false on erros.
191  */
193  const std::string& roiID,
194  const std::map< std::tuple< std::string, unsigned int, unsigned int >,
195  std::map< std::pair< double, double >, unsigned int> >& jointHistograms,
196  const std::map< std::pair< std::string, unsigned int >, std::map<double,
197  unsigned int> >& histograms,
198  te::rp::Matrix< double >& matrix );
199 
200  /*!
201  \brief Return the correlation matrix.
202  \param roiID Target ROI id.
203  \param jointHistograms Joint histograms.
204  \param histograms Single band histograms.
205  \param matrix Output matrix.
206  \return true if ok, false on erros.
207  */
209  const std::string& roiID,
210  const std::map< std::tuple< std::string, unsigned int, unsigned int >,
211  std::map< std::pair< double, double >, unsigned int> >& jointHistograms,
212  const std::map< std::pair< std::string, unsigned int >, std::map<double,
213  unsigned int> >& histograms,
214  te::rp::Matrix< double >& matrix );
215 
216  /*!
217  \brief Return the kurtosis matrix.
218  \param roiID Target ROI id.
219  \param jointHistograms Joint histograms.
220  \param histograms Single band histograms.
221  \param matrix Output matrix.
222  \return true if ok, false on erros.
223  */
225  const std::string& roiID,
226  const std::map< std::tuple< std::string, unsigned int, unsigned int >,
227  std::map< std::pair< double, double >, unsigned int> >& jointHistograms,
228  const std::map< std::pair< std::string, unsigned int >, std::map<double,
229  unsigned int> >& histograms,
230  te::rp::Matrix< double >& matrix );
231 
233 
234  /*!
235  \brief Return the current loaded ROIs IDs.
236  \return Return the current loaded ROIs IDs.
237  */
238  std::vector< std::string > getROIsIDs() const;
239 
240  protected slots:
241 
242  void histogramPushButtonClicked(bool checked);
243 
244  void scatterPushButtonClicked(bool checked);
245 
246  void statisticsPushButtonClicked(bool checked);
247 
248  void samplesPushButtonClicked(bool checked);
249 
250  void coStatisticsPushButtonClicked(bool checked);
251 
253  };
254 
255  } // namespace widgets
256  } // namespace qt
257 } // namespace te
258 
259 #endif // TE_QT_WIDGETS_RASTERSTATISTICSWIZARDPAGE_H
te::qt::widgets::RasterStatisticsWizardPage::isComplete
bool isComplete() const
te::qt::widgets::RasterStatisticsWizardPage::samplesPushButtonClicked
void samplesPushButtonClicked(bool checked)
te::rp::Matrix< double >
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::qt::widgets::RasterStatisticsWizardPage::m_uiStatPageForm
std::unique_ptr< Ui::RasterStatisticsWizardPageForm > m_uiStatPageForm
Definition: RasterStatisticsWizardPage.h:83
te::qt::widgets::RasterStatisticsWizardPage::getCovariance
static bool getCovariance(const std::string &roiID, const unsigned int &bandIdx1, const unsigned int &bandIdx2, const std::map< std::tuple< std::string, unsigned int, unsigned int >, std::map< std::pair< double, double >, unsigned int > > &jointHistograms, const std::map< std::pair< std::string, unsigned int >, std::map< double, unsigned int > > &histograms, double &covariance)
Return the covariance value.
te::qt::widgets::MapDisplay
A widget to control the display of a set of layers.
Definition: MapDisplay.h:72
te::map::AbstractLayerPtr
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
Definition: AbstractLayer.h:626
te::qt::widgets::RasterStatisticsWizardPage::statisticsPushButtonClicked
void statisticsPushButtonClicked(bool checked)
te::qt::widgets::RasterStatisticsWizardPage::getHistograms
bool getHistograms(std::map< std::pair< std::string, unsigned int >, std::map< double, unsigned int > > &realHistograms, std::map< std::pair< std::string, unsigned int >, std::map< double, unsigned int > > &imagHistograms) const
Return the current histograms.
te::qt::widgets::RasterStatisticsWizardPage::getKurtosis
static bool getKurtosis(const std::string &roiID, const unsigned int &bandIdx1, const std::map< std::tuple< std::string, unsigned int, unsigned int >, std::map< std::pair< double, double >, unsigned int > > &jointHistograms, const std::map< std::pair< std::string, unsigned int >, std::map< double, unsigned int > > &histograms, double &kurtosis)
Return the Kurtosis value.
te::qt::widgets::RasterStatisticsWizardPage::~RasterStatisticsWizardPage
~RasterStatisticsWizardPage()
te::qt::widgets::RasterStatisticsWizardPage::getCorrelation
static bool getCorrelation(const std::string &roiID, const unsigned int &bandIdx1, const unsigned int &bandIdx2, const std::map< std::tuple< std::string, unsigned int, unsigned int >, std::map< std::pair< double, double >, unsigned int > > &jointHistograms, const std::map< std::pair< std::string, unsigned int >, std::map< double, unsigned int > > &histograms, double &correlation)
Return the correlation value.
te::qt::widgets::RasterStatisticsWizardPage::m_layer
te::map::AbstractLayerPtr m_layer
Definition: RasterStatisticsWizardPage.h:86
te::cl::ROISet
A ROISet is a set of ROI's.
Definition: ROISet.h:54
TEQTWIDGETSEXPORT
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63
te::qt::widgets::RasterStatisticsWizardPage::getBandIndexes
void getBandIndexes(std::vector< unsigned int > &bandsIndexes) const
Return the current selected band indexes.
te::qt::widgets::RasterStatisticsWizardPage::scatterPushButtonClicked
void scatterPushButtonClicked(bool checked)
te::qt::widgets::RasterStatisticsWizardPage::setLayer
void setLayer(te::map::AbstractLayerPtr layer)
This method is used to set the selected layer for vectorization operation.
te::qt::widgets::RasterStatisticsWizardPage::getJoinHistograms
bool getJoinHistograms(const std::map< std::pair< std::string, unsigned int >, std::map< double, unsigned int > > &realHistograms, const std::map< std::pair< std::string, unsigned int >, std::map< double, unsigned int > > &imagHistograms, std::map< std::tuple< std::string, unsigned int, unsigned int >, std::map< std::pair< double, double >, unsigned int > > &realJointHistograms, std::map< std::tuple< std::string, unsigned int, unsigned int >, std::map< std::pair< double, double >, unsigned int > > &imagJointHistograms) const
Return the current joint histograms.
Ui
Definition: ConfigInputAddressDialog.h:44
te::qt::widgets::RasterStatisticsWizardPage::setActionGroup
void setActionGroup(QActionGroup *actionGroup)
slots
#define slots
Definition: VirtualMachine.h:48
te::qt::widgets::RasterStatisticsWizardPage::m_roiManagerPtr
std::unique_ptr< te::qt::widgets::ROIManagerDialog > m_roiManagerPtr
Definition: RasterStatisticsWizardPage.h:84
te::qt::widgets::RasterStatisticsWizardPage::RasterStatisticsWizardPage
RasterStatisticsWizardPage(QWidget *parent=0)
te::qt::widgets::RasterStatisticsWizardPage::coStatisticsPushButtonClicked
void coStatisticsPushButtonClicked(bool checked)
te::qt::widgets::RasterStatisticsWizardPage::getROIsIDs
std::vector< std::string > getROIsIDs() const
Return the current loaded ROIs IDs.
te::qt::widgets::RasterStatisticsWizardPage::getKurtosisMatrix
bool getKurtosisMatrix(const std::string &roiID, const std::map< std::tuple< std::string, unsigned int, unsigned int >, std::map< std::pair< double, double >, unsigned int > > &jointHistograms, const std::map< std::pair< std::string, unsigned int >, std::map< double, unsigned int > > &histograms, te::rp::Matrix< double > &matrix)
Return the kurtosis matrix.
te::qt::widgets::RasterStatisticsWizardPage::histogramPushButtonClicked
void histogramPushButtonClicked(bool checked)
RasterStatisticsWizardLog.h
te::qt::widgets::RasterStatisticsWizardPage::onROIManagerClosed
void onROIManagerClosed(te::cl::ROISet *rs)
te::qt::widgets::RasterStatisticsWizardPage::setMapDisplay
void setMapDisplay(te::qt::widgets::MapDisplay *mapDisplay)
te::qt::widgets::RasterStatisticsWizardPage::getCorrelationMatrix
bool getCorrelationMatrix(const std::string &roiID, const std::map< std::tuple< std::string, unsigned int, unsigned int >, std::map< std::pair< double, double >, unsigned int > > &jointHistograms, const std::map< std::pair< std::string, unsigned int >, std::map< double, unsigned int > > &histograms, te::rp::Matrix< double > &matrix)
Return the correlation matrix.
te::qt::widgets::RasterStatisticsWizardPage
Definition: RasterStatisticsWizardPage.h:57
te::qt::widgets::RasterStatisticsWizardPage::m_logDialogPtr
std::unique_ptr< te::qt::widgets::RasterStatisticsWizardLog > m_logDialogPtr
Definition: RasterStatisticsWizardPage.h:85
te::qt::widgets::RasterStatisticsWizardPage::printMatrix
bool printMatrix(te::rp::Matrix< double > &matrix)
te::qt::widgets::RasterStatisticsWizardPage::getCovarianceMatrix
bool getCovarianceMatrix(const std::string &roiID, const std::map< std::tuple< std::string, unsigned int, unsigned int >, std::map< std::pair< double, double >, unsigned int > > &jointHistograms, const std::map< std::pair< std::string, unsigned int >, std::map< double, unsigned int > > &histograms, te::rp::Matrix< double > &matrix)
Return the covariance matrix.