TiePointLocatorParametersWidget.cpp
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/TiePointLocatorParametersWidget.cpp
22 
23  \brief This file has the TiePointLocatorParametersWidget class.
24 */
25 
26 // TerraLib
27 #include "../../../common/STLUtils.h"
28 #include "../../../geometry/GTFactory.h"
29 #include "../../../geometry/GTParameters.h"
30 #include "../../../rp/TiePointsLocatorMoravecStrategy.h"
31 #include "../../../rp/TiePointsLocatorSURFStrategy.h"
33 #include "ui_TiePointLocatorParametersWidgetForm.h"
34 
35 // Qt
36 #include <QMessageBox>
37 
39  : QWidget(parent, f),
40  m_ui(new Ui::TiePointLocatorParametersWidgetForm)
41 {
42  m_ui->setupUi(this);
43 
45 }
46 
49 
50 Ui::TiePointLocatorParametersWidgetForm* te::qt::widgets::TiePointLocatorParametersWidget::getWidgetForm()
51 {
52  return m_ui.get();
53 }
54 
56 {
57  m_ui->m_glLabel->setVisible(false);
58  m_ui->m_enableGeometryFilterCheckBox->setVisible(false);
59 
60  m_ui->m_mtLabel->setVisible(false);
61  m_ui->m_enableMultiThreadCheckBox->setVisible(false);
62 
63  m_ui->m_gtLabel->setVisible(false);
64  m_ui->m_geomTransfNameComboBox->setVisible(false);
65 
66  m_ui->m_interLabel->setVisible(false);
67  m_ui->m_interpMethodComboBox->setVisible(false);
68 }
69 
71 {
72  m_ui->m_rescaleFactorLineEdit->setText(QString::number(value));
73 }
74 
76 {
77  return m_ui->m_geomTransfNameComboBox->currentText().toUtf8().data();
78 }
79 
81 {
83 
84  return m_inputParameters;
85 }
86 
88 {
89  m_ui->m_enableGeometryFilterCheckBox->setChecked(m_inputParameters.m_enableGeometryFilter);
90  m_ui->m_enableMultiThreadCheckBox->setChecked(m_inputParameters.m_enableMultiThread);
91 
93  {
94  int idx = m_ui->m_interesPointsLocationStrategyComboBox->findText("SURF");
95  m_ui->m_interesPointsLocationStrategyComboBox->setCurrentIndex(idx);
96  }
97  else
98  {
99  int idx = m_ui->m_interesPointsLocationStrategyComboBox->findText("Moravec");
100  m_ui->m_interesPointsLocationStrategyComboBox->setCurrentIndex(idx);
101  }
102 
105 
106  while( gtItB != gtItE )
107  {
108  m_ui->m_geomTransfNameComboBox->addItem(QString(gtItB->first.c_str()));
109  ++gtItB;
110  }
111 
112  int idx = m_ui->m_geomTransfNameComboBox->findText(m_inputParameters.m_geomTransfName.c_str());
113  m_ui->m_geomTransfNameComboBox->setCurrentIndex(idx);
114 
115  m_ui->m_geometryFilterAssuranceLineEdit->setText(QString::number(m_inputParameters.m_geometryFilterAssurance));
116 
117  m_ui->m_geomTransfMaxErrorLineEdit->setText(QString::number(m_inputParameters.m_geomTransfMaxError));
118 
120  {
121  case te::rst::Bilinear :
122  {
123  int idx = m_ui->m_interpMethodComboBox->findText("Bilinear");
124  m_ui->m_interpMethodComboBox->setCurrentIndex(idx);
125  break;
126  }
127  case te::rst::Bicubic :
128  {
129  int idx = m_ui->m_interpMethodComboBox->findText("Bicubic");
130  m_ui->m_interpMethodComboBox->setCurrentIndex(idx);
131  break;
132  }
133  default:
134  {
135  int idx = m_ui->m_interpMethodComboBox->findText("NearestNeighbor");
136  m_ui->m_interpMethodComboBox->setCurrentIndex(idx);
137  }
138  }
139 
140  m_ui->m_maxTiePointsLineEdit->setText(QString::number(m_inputParameters.m_maxTiePoints));
141 
142  {
144 
145  m_ui->m_correlationWindowWidthLineEdit->setText(QString::number(specPars.m_moravecCorrelationWindowWidth));
146 
147  m_ui->m_gaussianFilterIterationsLineEdit->setText(QString::number(specPars.m_moravecNoiseFilterIterations));
148 
149  m_ui->m_minAbsCorrelationLineEdit->setText(QString::number(specPars.m_moravecMinAbsCorrelation));
150 
151  m_ui->m_moravecWindowWidthLineEdit->setText(QString::number(specPars.m_moravecWindowWidth));
152  }
153 
154  {
156 
157  m_ui->m_maxNormEuclideanDistLineEdit->setText(QString::number(specPars.m_surfMaxNormEuclideanDist));
158 
159  m_ui->m_octavesNumberLineEdit->setText(QString::number(specPars.m_surfOctavesNumber));
160 
161  m_ui->m_scalesNumberLineEdit->setText(QString::number(specPars.m_surfScalesNumber));
162  }
163 
164  m_ui->m_rescaleFactorLineEdit->setText(QString::number(m_inputParameters.m_subSampleOptimizationRescaleFactor));
165 }
166 
168 {
169  m_inputParameters.m_enableGeometryFilter = m_ui->m_enableGeometryFilterCheckBox->isChecked();
170 
171  m_inputParameters.m_enableMultiThread = m_ui->m_enableMultiThreadCheckBox->isChecked();
172 
173  if(m_ui->m_interesPointsLocationStrategyComboBox->currentText() == "SURF")
175  else
177 
178  m_inputParameters.m_geomTransfName = m_ui->m_geomTransfNameComboBox->currentText().toUtf8().data();
179 
180  if(m_ui->m_geometryFilterAssuranceLineEdit->text().isEmpty())
181  {
182  QMessageBox::warning(this, tr("Warning"), tr("Geometry assurance not defined."));
183  return;
184  }
185  m_inputParameters.m_geometryFilterAssurance = m_ui->m_geometryFilterAssuranceLineEdit->text().toDouble();
186 
187  if(m_ui->m_geomTransfMaxErrorLineEdit->text().isEmpty())
188  {
189  QMessageBox::warning(this, tr("Warning"), tr("Transformation error not defined."));
190  return;
191  }
192  m_inputParameters.m_geomTransfMaxError = m_ui->m_geomTransfMaxErrorLineEdit->text().toDouble();
193 
194  if(m_ui->m_interpMethodComboBox->currentText() == "Bilinear")
196  else if(m_ui->m_interpMethodComboBox->currentText() == "Bicubic")
198  else
200 
201  if(m_ui->m_maxTiePointsLineEdit->text().isEmpty())
202  {
203  QMessageBox::warning(this, tr("Warning"), tr("Maximum number of tie-points not defined."));
204  return;
205  }
206  m_inputParameters.m_maxTiePoints = m_ui->m_maxTiePointsLineEdit->text().toUInt();
207 
208  if(m_ui->m_rescaleFactorLineEdit->text().isEmpty())
209  {
210  QMessageBox::warning(this, tr("Warning"), tr("Sub-sampled search rescale factor not defined."));
211  return;
212  }
213  m_inputParameters.m_subSampleOptimizationRescaleFactor = m_ui->m_rescaleFactorLineEdit->text().toDouble();
214 
215  if(m_ui->m_interesPointsLocationStrategyComboBox->currentText() == "SURF")
216  {
218 
219  if(m_ui->m_maxNormEuclideanDistLineEdit->text().isEmpty())
220  {
221  QMessageBox::warning(this, tr("Warning"), tr("Maximum euclidean distance not defined."));
222  return;
223  }
224  specPars.m_surfMaxNormEuclideanDist = m_ui->m_maxNormEuclideanDistLineEdit->text().toDouble();
225 
226  if(m_ui->m_octavesNumberLineEdit->text().isEmpty())
227  {
228  QMessageBox::warning(this, tr("Warning"), tr("Octaves number not defined."));
229  return;
230  }
231  specPars.m_surfOctavesNumber = m_ui->m_octavesNumberLineEdit->text().toUInt();
232 
233  if(m_ui->m_scalesNumberLineEdit->text().isEmpty())
234  {
235  QMessageBox::warning(this, tr("Warning"), tr("Scales number not defined."));
236  return;
237  }
238  specPars.m_surfScalesNumber = m_ui->m_scalesNumberLineEdit->text().toUInt();
239 
241  }
242  else
243  {
245 
246  if(m_ui->m_correlationWindowWidthLineEdit->text().isEmpty())
247  {
248  QMessageBox::warning(this, tr("Warning"), tr("Correlation window width not defined."));
249  return;
250  }
251  specPars.m_moravecCorrelationWindowWidth = m_ui->m_correlationWindowWidthLineEdit->text().toUInt();
252 
253  if(m_ui->m_gaussianFilterIterationsLineEdit->text().isEmpty())
254  {
255  QMessageBox::warning(this, tr("Warning"), tr("Gaussian filter iterations not defined."));
256  return;
257  }
258  specPars.m_moravecNoiseFilterIterations = m_ui->m_gaussianFilterIterationsLineEdit->text().toUInt();
259 
260  if(m_ui->m_minAbsCorrelationLineEdit->text().isEmpty())
261  {
262  QMessageBox::warning(this, tr("Warning"), tr("Minimum correlation value not defined."));
263  return;
264  }
265  specPars.m_moravecMinAbsCorrelation = m_ui->m_minAbsCorrelationLineEdit->text().toDouble();
266 
267  if(m_ui->m_moravecWindowWidthLineEdit->text().isEmpty())
268  {
269  QMessageBox::warning(this, tr("Warning"), tr("Moravec window width not defined."));
270  return;
271  }
272  specPars.m_moravecWindowWidth = m_ui->m_moravecWindowWidthLineEdit->text().toUInt();
273 
275  }
276 }
Near neighborhood interpolation method.
unsigned int m_surfScalesNumber
The number of sub-sampling scales to generate, when applicable (default:3, minimum:3).
double m_geomTransfMaxError
The maximum allowed transformation error (pixel units, default:2).
te::rp::TiePointsLocator::InputParameters m_inputParameters
The current parameters.
double m_subSampleOptimizationRescaleFactor
Sub-sampled optimization tie-points search rescale factor (Tie-ponts will be searched into a subsabmp...
static dictionary_type & getDictionary()
It returns a reference to the internal dictionary of concrete factories.
TiePointsLocator SURF strategy parameters.
unsigned int m_moravecWindowWidth
The Moravec window width used to locate canditate tie-points (minimum 3, default: 21...
std::string m_interesPointsLocationStrategyName
The strategy used to locate interest points (default:Moravec).
This file has the TiePointLocatorParametersWidget class.
te::rp::TiePointsLocator::InputParameters getTiePointInputParameters()
void setSpecStrategyParams(const TiePointsLocatorStrategyParameters &specStratParams)
Set specific tie-points locator strategy parameters.
unsigned int m_maxTiePoints
The maximum number of tie-points to generate (0:Automatically calculated, default:2500).
std::map< TFACTORYKEY, TFACTORY *, TKEYCOMPARE >::const_iterator const_iterator
double m_geometryFilterAssurance
Geometry assurance (the error-free selection percent assurance) - Use Lower values for good tie-point...
bool m_enableGeometryFilter
Enable/disable the geometry filter/outliers remotion (default:true).
unsigned int m_surfOctavesNumber
The number of octaves to generate, when applicable (default: 2, minimum:2).
TiePointsLocator Moravec strategy parameters.
unsigned int m_moravecCorrelationWindowWidth
The correlation window width used to correlate points between the images (minimum 3...
void startAdvancedOptions()
Fill interface widget with initial values.
std::map< TFACTORYKEY, TFACTORY *, TKEYCOMPARE >::const_iterator end() const
It returns an iterator to the end of the container.
Bicubic interpolation method.
void updateAdvancedOptions()
Update tie point values with advanced options changed values.
Ui::TiePointLocatorParametersWidgetForm * getWidgetForm()
TiePointLocatorParametersWidget(QWidget *parent=0, Qt::WindowFlags f=0)
unsigned int m_moravecNoiseFilterIterations
The number of noise filter iterations, when applicable (used to remove image noise, zero will disable the noise Filter, default:1).
std::map< TFACTORYKEY, TFACTORY *, TKEYCOMPARE >::const_iterator begin() const
It returns an iterator to the first stored factory.
bool m_enableMultiThread
Enable/Disable the use of multi-threads (default:true).
std::unique_ptr< Ui::TiePointLocatorParametersWidgetForm > m_ui
Bilinear interpolation method.
std::string m_geomTransfName
The name of the geometric transformation used to ensure tie-points consistency (see each te::gm::GTFa...
double m_surfMaxNormEuclideanDist
The maximum acceptable euclidean distance when matching features (when applicable), default:0.75, valid range: [0,1].
double m_moravecMinAbsCorrelation
The minimum acceptable absolute correlation value when matching features (when applicable), default:0.25, valid range: [0,1].
te::rst::Interpolator::Method m_interpMethod
The raster interpolator method (default:NearestNeighbor).