29 #include "../../../rp/Segmenter.h" 30 #include "../../../rp/SegmenterRegionGrowingBaatzStrategy.h" 31 #include "../../../rp/SegmenterRegionGrowingMeanStrategy.h" 32 #include <ui_SegmenterForm.h> 34 #include <QMessageBox> 35 #include <QListWidgetItem> 40 te::rst::Raster const* inputRasterPtr,
const std::string& outpuRasterDSType,
41 const std::map< std::string, std::string >& outpuRasterInfo,
42 QWidget* parent, Qt::WindowFlags f)
44 m_inputRasterPtr( inputRasterPtr ),
45 m_outpuRasterDSType( outpuRasterDSType ),
46 m_outpuRasterInfo( outpuRasterInfo )
48 m_uiPtr =
new Ui::SegmenterForm;
56 for(
unsigned int inRasterBandsIdx = 0 ; inRasterBandsIdx <
59 m_uiPtr->m_inputRasterBandsListWidget->addItem(
60 QString::number( inRasterBandsIdx ) );
70 boost::shared_ptr< te::rst::Raster >& outputRasterPtr )
95 QList<QListWidgetItem *> selectedBands =
96 m_uiPtr->m_inputRasterBandsListWidget->selectedItems();
98 if( selectedBands.size() > 0 )
100 QList<QListWidgetItem *>::const_iterator itBegin = selectedBands.begin();
101 QList<QListWidgetItem *>::const_iterator itEnd = selectedBands.end();
102 while( itBegin != itEnd )
109 m_uiPtr->m_enableThreadedProcessingcheckBox->isChecked();
112 m_uiPtr->m_enableBlockProcessingcheckBox->isChecked();
118 algoInputParams.
m_strategyName =
m_uiPtr->m_segmenterStrategyComboBox->currentText().toUtf8().data();
124 m_uiPtr->m_minimumSegmentSizeRGLineEdit->text().toUInt();
126 m_uiPtr->m_segmentsSimilarityThresholdRGLineEdit->text().toDouble();
135 m_uiPtr->m_minimumSegmentSizeRGLineEdit->text().toUInt();
137 m_uiPtr->m_segmentsSimilarityThresholdRGLineEdit->text().toDouble();
149 if( algorithmInstance.
initialize( algoInputParams ) )
151 if( algorithmInstance.
execute( algoOutputParams ) )
154 QMessageBox::information(
this,
"", tr(
"Segmentation ended sucessfully"));
158 QMessageBox::critical(
this,
"", tr(
"Segmentation execution error"));
163 QMessageBox::critical(
this,
"", tr(
"Segmentation initialization error"));
168 QMessageBox::critical(
this,
"", tr(
"Invalid number of bands"));
173 QMessageBox::critical(
this,
"", tr(
"Invalid input raster"));
Segmenter Output Parameters.
double m_segmentsSimilarityThreshold
Segments similarity treshold - Use lower values to merge only those segments that are more similar - ...
bool initialize(const AlgorithmInputParameters &inputParams)
Initialize the algorithm instance making it ready for execution.
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
unsigned int m_minSegmentSize
A positive minimum segment size (pixels number - default: 100).
A dialog used to execute image segmentation.
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.
double m_segmentsSimilarityThreshold
Segments similarity treshold - Use lower values to merge only those segments that are more similar - ...
unsigned int m_minSegmentSize
A positive minimum segment size (pixels number - default: 100).
std::map< std::string, std::string > m_rInfo
The necessary information to create the raster (as described in te::raster::RasterFactory).
bool execute(AlgorithmOutputParameters &outputParams)
Executes the algorithm using the supplied parameters.
std::unique_ptr< te::rst::Raster > m_outputRasterPtr
A pointer the ge generated output raster (label image).