27 #include "../../../rp/Classifier.h"
28 #include "../../../rp/ClassifierISOSegStrategy.h"
32 #include <ui_ClassifierForm.h>
35 #include <QListWidgetItem>
36 #include <QMessageBox>
39 const std::string& outpuRasterDSType,
const std::map<std::string, std::string>& outpuRasterInfo,
40 QWidget* parent, Qt::WindowFlags f)
42 m_inputRasterPtr(inputRasterPtr),
43 m_inputPolygons(inputPolygons),
44 m_outpuRasterDSType(outpuRasterDSType),
45 m_outpuRasterInfo(outpuRasterInfo)
47 m_uiPtr =
new Ui::ClassifierForm;
56 m_uiPtr->m_inputRasterBandsListWidget->addItem(QString::number(b));
58 m_uiPtr->m_helpPushButton->setPageReference(
"widgets/rp/classifier.html");
68 if(m_outputRasterPtr.get())
70 outputRasterPtr = m_outputRasterPtr;
80 m_outputRasterPtr.reset();
82 if (!m_inputRasterPtr)
84 QMessageBox::critical(
this,
"", tr(
"Invalid input raster"));
97 QList<QListWidgetItem*> selectedBands = m_uiPtr->m_inputRasterBandsListWidget->selectedItems();
99 if(selectedBands.size() <= 0)
101 QMessageBox::critical(
this,
"", tr(
"Invalid number of bands"));
106 QList<QListWidgetItem*>::const_iterator it = selectedBands.begin();
107 QList<QListWidgetItem*>::const_iterator itend = selectedBands.end();
118 classifierparameters.
m_acceptanceThreshold = m_uiPtr->m_acceptanceThresholdComboBox->currentText().toDouble();
124 algoOutputParameters.
m_rInfo = m_outpuRasterInfo;
125 algoOutputParameters.
m_rType = m_outpuRasterDSType;
130 if(!classifierinstance.
initialize(algoInputParameters))
132 QMessageBox::critical(
this,
"", tr(
"Classifier initialization error"));
136 if(!classifierinstance.
execute(algoOutputParameters))
138 QMessageBox::critical(
this,
"", tr(
"Classifier execution error"));
143 QMessageBox::information(
this,
"", tr(
"Classification ended sucessfully"));
A dialog used to execute image classification.
bool execute(AlgorithmOutputParameters &outputParams)
Executes the algorithm using the supplied parameters.
Classifier output parameters.
An abstract class for raster data strucutures.
virtual std::size_t getNumberOfBands() const =0
Returns the number of bands (dimension of cells attribute values) in the raster.
bool initialize(const AlgorithmInputParameters &inputParams)
Initialize the algorithm instance making it ready for execution.
double m_acceptanceThreshold
The acceptance threshold (the closer to 100%, few clusters are created).
std::map< std::string, std::string > m_rInfo
The necessary information to create the raster (as described in te::raster::RasterFactory).
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).