29 #include "../../../rp/Segmenter.h" 
   30 #include "../../../rp/SegmenterRegionGrowingStrategy.h" 
   31 #include <ui_SegmenterForm.h> 
   33 #include <QtGui/QMessageBox> 
   34 #include <QtGui/QListWidgetItem> 
   39   te::rst::Raster const* inputRasterPtr, 
const std::string& outpuRasterDSType, 
 
   40   const std::map< std::string, std::string >& outpuRasterInfo, 
 
   41   QWidget* parent, Qt::WindowFlags f)
 
   42   : QDialog( parent, f ),
 
   43     m_inputRasterPtr( inputRasterPtr ),
 
   44     m_outpuRasterDSType( outpuRasterDSType ),
 
   45     m_outpuRasterInfo( outpuRasterInfo )
 
   47   m_uiPtr = 
new Ui::SegmenterForm;
 
   55   for( 
unsigned int inRasterBandsIdx = 0 ; inRasterBandsIdx < 
 
   58     m_uiPtr->m_inputRasterBandsListWidget->addItem( 
 
   59       QString::number( inRasterBandsIdx ) );
 
   69   boost::shared_ptr< te::rst::Raster >& outputRasterPtr )
 
   71   if( m_outputRasterPtr.get() )
 
   73     outputRasterPtr = m_outputRasterPtr;
 
   84   m_outputRasterPtr.reset();
 
   86   if( m_inputRasterPtr )
 
   94     QList<QListWidgetItem *> selectedBands = 
 
   95       m_uiPtr->m_inputRasterBandsListWidget->selectedItems();
 
   97     if( selectedBands.size() > 0 )
 
   99       QList<QListWidgetItem *>::const_iterator itBegin = selectedBands.begin();
 
  100       QList<QListWidgetItem *>::const_iterator itEnd = selectedBands.end();
 
  101       while( itBegin != itEnd )
 
  108         m_uiPtr->m_enableThreadedProcessingcheckBox->isChecked();
 
  109       algoInputParams.
m_maxSegThreads = m_uiPtr->m_maximumThreadsNumberLineEdit->text().toUInt();
 
  111         m_uiPtr->m_enableBlockProcessingcheckBox->isChecked();
 
  113         m_uiPtr->m_enableBlockMergingCheckBox->isChecked();
 
  114       algoInputParams.
m_maxBlockSize = m_uiPtr->m_maximumBlockSizeLineEdit->text().toUInt();
 
  117       algoInputParams.
m_strategyName = m_uiPtr->m_segmenterStrategyComboBox->currentText().toStdString();
 
  123           m_uiPtr->m_minimumSegmentSizeRGLineEdit->text().toUInt();
 
  125           m_uiPtr->m_segmentsSimilarityThresholdRGLineEdit->text().toDouble();
 
  130       algoOutputParams.
m_rInfo = m_outpuRasterInfo;
 
  131       algoOutputParams.
m_rType = m_outpuRasterDSType;
 
  137       if( algorithmInstance.
initialize( algoInputParams ) )
 
  139         if( algorithmInstance.
execute( algoOutputParams ) )
 
  142           QMessageBox::information(
this, 
"", tr(
"Segmentation ended sucessfully"));
 
  146           QMessageBox::critical(
this, 
"", tr(
"Segmentation execution error"));
 
  151         QMessageBox::critical(
this, 
"", tr(
"Segmentation initialization error"));
 
  156       QMessageBox::critical(
this, 
"", tr(
"Invalid number of bands"));
 
  161     QMessageBox::critical(
this, 
"", tr(
"Invalid input raster"));
 
std::auto_ptr< te::rst::Raster > m_outputRasterPtr
A pointer the ge generated output raster (label image). 
 
std::string m_strategyName
The segmenter strategy name see each te::rp::SegmenterStrategyFactory inherited classes documentation...
 
std::map< std::string, std::string > m_rInfo
The necessary information to create the raster (as described in te::raster::RasterFactory). 
 
Ui::SegmenterForm * m_uiPtr
 
A dialog used to execute image segmentation. 
 
Segmenter Input Parameters. 
 
bool m_enableBlockMerging
If true, a block merging procedure will be performed (default:true). 
 
te::rst::Raster const * m_inputRasterPtr
Input raster. 
 
Segmenter Output Parameters. 
 
unsigned int m_maxSegThreads
The maximum number of concurrent segmenter threads (default:0 - automatically found). 
 
virtual std::size_t getNumberOfBands() const =0
Returns the number of bands (dimension of cells attribute values) in the raster. 
 
SegmenterDialog(te::rst::Raster const *inputRasterPtr, const std::string &outpuRasterDSType, const std::map< std::string, std::string > &outpuRasterInfo, QWidget *parent=0, Qt::WindowFlags f=0)
Constructs a basic dialog which is a child of parent, with widget flags set to f. ...
 
bool m_enableBlockProcessing
If true, the original raster will be splitted into small blocks, each one will be segmented independe...
 
bool initialize(const AlgorithmInputParameters &inputParams)
Initialize the algorithm instance making it ready for execution. 
 
bool m_enableThreadedProcessing
If true, threaded processing will be performed (best with multi-core or multi-processor systems (defa...
 
~SegmenterDialog()
Destructor. 
 
bool getOutputRaster(boost::shared_ptr< te::rst::Raster > &outputRasterPtr)
Returns the output result raster. 
 
bool execute(AlgorithmOutputParameters &outputParams)
Executes the algorithm using the supplied parameters. 
 
unsigned int m_minSegmentSize
A positive minimum segment size (pixels number - default: 100). 
 
std::vector< unsigned int > m_inputRasterBands
Bands to be processed from the input raster. 
 
double m_segmentsSimilarityThreshold
Segments similarity treshold - Segments with similarity values below this value will be merged; valid...
 
An abstract class for raster data strucutures. 
 
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 ). 
 
void setSegStrategyParams(const SegmenterStrategyParameters &segStratParams)
Set specific segmenter strategy parameters. 
 
void on_okPushButton_clicked()