27 #include "../../../common/progress/ProgressManager.h"
28 #include "../../../dataaccess/dataset/DataSet.h"
29 #include "../../../dataaccess/utils/Utils.h"
30 #include "../../../raster/Raster.h"
31 #include "../../../rp/Segmenter.h"
32 #include "../../../rp/SegmenterRegionGrowingStrategy.h"
33 #include "../../../rp/Module.h"
34 #include "../../widgets/help/HelpPushButton.h"
35 #include "../../widgets/progress/ProgressViewerDialog.h"
43 #include "ui_SegmenterAdvancedOptionsWizardPageForm.h"
50 #include <QtGui/QMessageBox>
57 this->setWizardStyle(QWizard::ModernStyle);
58 this->setWindowTitle(tr(
"Segmenter"));
61 this->setOption(QWizard::HaveHelpButton,
true);
62 this->setOption(QWizard::HelpButtonOnRight,
false);
66 this->setButton(QWizard::HelpButton, helpButton);
80 if(currentPage() == m_layerSearchPage.get())
82 std::list<te::map::AbstractLayerPtr> list = m_layerSearchPage->getSearchWidget()->getSelecteds();
84 if(list.empty() ==
false)
88 m_segmenterPage->set(l);
91 return m_layerSearchPage->isComplete();
93 else if(currentPage() == m_segmenterPage.get())
95 bool res = m_segmenterPage->isComplete();
98 QMessageBox::warning(
this, tr(
"Warning"), tr(
"Select at least one band."));
102 else if(currentPage() == m_rasterInfoPage.get())
112 m_layerSearchPage->getSearchWidget()->setList(layerList);
113 m_layerSearchPage->getSearchWidget()->filterOnlyByRaster();
118 removePage(m_layerSearchId);
120 m_segmenterPage->set(layer);
125 return m_outputLayer;
135 m_layerSearchId = addPage(m_layerSearchPage.get());
136 addPage(m_segmenterPage.get());
137 addPage(m_segmenterAdvOptPage.get());
138 addPage(m_rasterInfoPage.get());
141 m_layerSearchPage->getSearchWidget()->enableMultiSelection(
false);
146 if(m_rasterInfoPage->getWidget()->fileExists())
148 QMessageBox::warning(
this, tr(
"Segmenter"), tr(
"File already exists."));
154 std::auto_ptr<te::da::DataSet> ds(l->getData());
162 algoInputParams.
m_enableThreadedProcessing = m_segmenterAdvOptPage->getForm()->m_enableThreadedProcessingcheckBox->isChecked();
163 algoInputParams.
m_maxSegThreads = m_segmenterAdvOptPage->getForm()->m_maximumThreadsNumberLineEdit->text().toUInt();
164 algoInputParams.
m_enableBlockProcessing = m_segmenterAdvOptPage->getForm()->m_enableBlockProcessingcheckBox->isChecked();
165 algoInputParams.
m_enableBlockMerging = m_segmenterAdvOptPage->getForm()->m_enableBlockMergingCheckBox->isChecked();
166 algoInputParams.
m_maxBlockSize = m_segmenterAdvOptPage->getForm()->m_maximumBlockSizeLineEdit->text().toUInt();
169 algoOutputParams.
m_rType = m_rasterInfoPage->getWidget()->getType();
170 algoOutputParams.
m_rInfo = m_rasterInfoPage->getWidget()->getInfo();
176 QApplication::setOverrideCursor(Qt::WaitCursor);
180 if(algorithmInstance.initialize(algoInputParams))
182 if(algorithmInstance.execute(algoOutputParams))
184 algoOutputParams.
reset();
188 m_rasterInfoPage->getWidget()->getInfo());
190 QMessageBox::information(
this, tr(
"Segmenter"), tr(
"Segmenter ended sucessfully"));
194 QMessageBox::critical(
this, tr(
"Segmenter"), tr(
"Segmenter execution error"));
198 QApplication::restoreOverrideCursor();
205 QMessageBox::critical(
this, tr(
"Segmenter"), tr(
"Segmenter initialization error") +
210 QApplication::restoreOverrideCursor();
215 catch(
const std::exception& e)
217 QMessageBox::warning(
this, tr(
"Register"), e.what());
221 QApplication::restoreOverrideCursor();
227 QMessageBox::warning(
this, tr(
"Register"), tr(
"An exception has occuried!"));
231 QApplication::restoreOverrideCursor();
238 QApplication::restoreOverrideCursor();
bool m_enableProgress
Enable/Disable the progress interface (default:false).
This file defines a class for a Segmenter Wizard page.
This class is GUI used to define the segmenter advanced options parameters for the RP constast operat...
std::map< std::string, std::string > m_rInfo
The necessary information to create the raster (as described in te::raster::RasterFactory).
static const std::string & getLastLogStr()
Returns the last log string generated by this module.
SegmenterWizard(QWidget *parent)
This file defines a class for a Raster Info Wizard page.
Segmenter Input Parameters.
bool m_enableBlockMerging
If true, a block merging procedure will be performed (default:true).
This file has the RasterInfoWidget class.
Segmenter Output Parameters.
unsigned int m_maxSegThreads
The maximum number of concurrent segmenter threads (default:0 - automatically found).
void setLayer(te::map::AbstractLayerPtr layer)
Push button that uses te::qt::widgets::HelpManager on its mouse pressed implementation.
te::map::AbstractLayerPtr getOutputLayer()
bool m_enableBlockProcessing
If true, the original raster will be splitted into small blocks, each one will be segmented independe...
This file defines the LayerSearchWizardPage class.
This file defines the LayerSearchWidget class.
bool m_enableThreadedProcessing
If true, threaded processing will be performed (best with multi-core or multi-processor systems (defa...
Utility functions for the data access module.
TEQTWIDGETSEXPORT te::map::AbstractLayerPtr createLayer(const std::string &driverName, const std::map< std::string, std::string > &connInfo)
void setPageReference(const QString &ref)
Sets the documentation page reference.
void reset()
Clear all internal allocated resources and reset the parameters instance to its initial state...
This class is GUI used to define the raster info parameters for raster factory.
void setList(std::list< te::map::AbstractLayerPtr > &layerList)
A Qt dialog that allows users to run a segmenter operation defined by RP module.
This class is GUI used to define the segmenter parameters for the RP constast operation.
This file defines a class for a Segmenter Advanced Options Wizard page.
boost::intrusive_ptr< AbstractLayer > AbstractLayerPtr
static T & getInstance()
It returns a reference to the singleton instance.
unsigned int m_maxBlockSize
The input image will be split into blocks with this width for processing, this parameter tells the ma...
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
virtual bool validateCurrentPage()