Raster segmentation. More...
#include <Segmenter.h>
Classes | |
class | InputParameters |
Segmenter Input Parameters. More... | |
class | OutputParameters |
Segmenter Output Parameters. More... | |
class | SegmenterThreadEntryParams |
The parameters passed to the Segmenter::segmenterthreadEntry method. More... | |
Public Member Functions | |
bool | execute (AlgorithmOutputParameters &outputParams) throw ( te::rp::Exception ) |
Executes the algorithm using the supplied parameters. More... | |
bool | initialize (const AlgorithmInputParameters &inputParams) throw ( te::rp::Exception ) |
Initialize the algorithm instance making it ready for execution. More... | |
bool | isInitialized () const |
Returns true if the algorithm instance is initialized and ready for execution. More... | |
void | reset () throw ( te::rp::Exception ) |
Clear all internal allocated objects and reset the algorithm to its initial state. More... | |
Segmenter () | |
~Segmenter () | |
Protected Types | |
typedef te::rp::Matrix< SegmenterSegmentsBlock > | SegmentsBlocksMatrixT |
Protected Member Functions | |
bool | calcBestBlockSize (const unsigned int minExapandedBlockPixels, const unsigned int maxExapandedBlockPixels, unsigned int &blocksHOverlapSize, unsigned int &blocksVOverlapSize, unsigned int &nonExpandedBlockWidth, unsigned int &nonExpandedBlockHeight, unsigned int &expandedBlockWidth, unsigned int &expandedBlockHeight) const |
Calc the best sub-image block size for each thread to process. More... | |
bool | createCutOffLinesTiff (const std::vector< std::vector< unsigned int > > &imageHorizontalProfiles, const std::vector< unsigned int > &imageHorizontalProfilesCenterLines, const std::vector< std::vector< unsigned int > > &imageVerticalProfiles, const std::vector< unsigned int > &imageVerticalProfilesCenterLines, const std::string &filename) |
bool | genImageHCutOffProfile (const unsigned int profileCenter, const te::rst::Raster &inRaster, const std::vector< unsigned int > &inRasterBands, const unsigned int pixelNeighborhoodSize, const unsigned int tileNeighborhoodSize, const unsigned int profileAntiSmoothingFactor, std::vector< unsigned int > &profile) const |
Generate the horizontal cutOff prifles for the entire image.. More... | |
bool | genImageVCutOffProfile (const unsigned int profileCenter, const te::rst::Raster &inRaster, const std::vector< unsigned int > &inRasterBands, const unsigned int pixelNeighborhoodSize, const unsigned int tileNeighborhoodSize, const unsigned int profileAntiSmoothingFactor, std::vector< unsigned int > &profile) const |
Generate the vertical cutOff prifles for the entire image.. More... | |
bool | updateBlockCutOffProfiles (const std::vector< std::vector< unsigned int > > &imageHorizontalProfiles, const std::vector< std::vector< unsigned int > > &imageVerticalProfiles, SegmenterSegmentsBlock &segmentsBlock) const |
Update the block cutOff profiles using the full image profiles. More... | |
Static Protected Member Functions | |
static void | segmenterThreadEntry (SegmenterThreadEntryParams *paramsPtr) |
Segmenter thread entry. More... | |
Protected Attributes | |
Segmenter::InputParameters | m_inputParameters |
Segmenter execution parameters. More... | |
bool | m_instanceInitialized |
Raster segmentation.
Raster segmentation following the choosed segmentation strategy.
Definition at line 73 of file Segmenter.h.
|
protected |
Segments blocks matrix type definition
Definition at line 194 of file Segmenter.h.
te::rp::Segmenter::Segmenter | ( | ) |
Definition at line 208 of file Segmenter.cpp.
References m_instanceInitialized.
te::rp::Segmenter::~Segmenter | ( | ) |
Definition at line 213 of file Segmenter.cpp.
|
protected |
Calc the best sub-image block size for each thread to process.
minBlockPixels | The minimun allowed pixels number for each block (expanded block). |
maxBlockPixels | The maximum allowed pixels number for each block (expanded block). |
blocksHOverlapSize | The blocks horizontal overlap size (number of columns). |
blocksVOverlapSize | The blocks vertical overlap size (number of rows). |
nonExpandedBlockWidth | The calculated non-expanded block width (non-expanded block). |
nonExpandedBlockHeight | The calculated non-expanded block height (non-expanded block). |
expandedBlockWidth | The calculated expanded block width (non-expanded block). |
expandedBlockHeight | The calculated expanded block height (non-expanded block). |
Definition at line 846 of file Segmenter.cpp.
References te::rst::Raster::getNumberOfColumns(), te::rst::Raster::getNumberOfRows(), te::rp::Segmenter::InputParameters::m_blocksOverlapPercent, m_inputParameters, te::rp::Segmenter::InputParameters::m_inputRasterPtr, and TERP_TRUE_OR_THROW.
Referenced by execute().
|
protected |
Definition at line 1562 of file Segmenter.cpp.
References te::rst::Raster::getBand(), te::rst::Raster::getGrid(), te::rst::Band::getProperty(), te::rst::GrayIdxCInt, m_inputParameters, te::rp::Segmenter::InputParameters::m_inputRasterBands, te::rp::Segmenter::InputParameters::m_inputRasterPtr, te::rst::RasterFactory::make(), TERP_TRUE_OR_RETURN_FALSE, TERP_TRUE_OR_THROW, and te::dt::UCHAR_TYPE.
|
virtual |
Executes the algorithm using the supplied parameters.
outputParams | Output parameters. |
Implements te::rp::Algorithm.
Definition at line 217 of file Segmenter.cpp.
References te::rp::SegmenterSegmentsBlock::BlockNotProcessed, te::rp::SegmenterSegmentsBlock::BlockSegmented, calcBestBlockSize(), genImageHCutOffProfile(), genImageVCutOffProfile(), te::rst::Raster::getBand(), te::rst::Band::getBlockSize(), te::rp::Matrix< TemplateElementType >::getColumnsNumber(), te::rst::Raster::getGrid(), te::rp::Matrix< TemplateElementType >::getLinesNumber(), te::rst::Raster::getNumberOfColumns(), te::rst::Raster::getNumberOfRows(), te::common::GetPhysProcNumber(), te::rst::Band::getProperty(), te::rp::Segmenter::InputParameters::getSegStrategyParams(), te::common::GetTotalPhysicalMemory(), te::common::GetTotalVirtualMemory(), te::common::GetUsedVirtualMemory(), te::rst::Band::getValue(), te::rst::GrayIdxCInt, te::rp::Segmenter::SegmenterThreadEntryParams::m_abortSegmentationFlagPtr, te::rp::Segmenter::SegmenterThreadEntryParams::m_blockProcessedSignalMutexPtr, te::rp::Segmenter::SegmenterThreadEntryParams::m_blockProcessedSignalPtr, te::rp::Segmenter::InputParameters::m_blocksOverlapPercent, te::rp::SegmenterSegmentsBlock::m_bottomCutOffProfile, te::rp::Segmenter::InputParameters::m_enableBlockProcessing, te::rp::Segmenter::InputParameters::m_enableProgress, te::rp::Segmenter::InputParameters::m_enableRasterCache, te::rp::Segmenter::SegmenterThreadEntryParams::m_enableStrategyProgress, te::rp::Segmenter::InputParameters::m_enableThreadedProcessing, te::rp::Segmenter::SegmenterThreadEntryParams::m_generalMutexPtr, te::rp::SegmenterSegmentsBlock::m_height, te::rp::Segmenter::SegmenterThreadEntryParams::m_inputParameters, m_inputParameters, te::rp::Segmenter::SegmenterThreadEntryParams::m_inputRasterBandMaxValues, te::rp::Segmenter::SegmenterThreadEntryParams::m_inputRasterBandMinValues, te::rp::Segmenter::InputParameters::m_inputRasterBands, te::rp::Segmenter::InputParameters::m_inputRasterNoDataValues, te::rp::Segmenter::SegmenterThreadEntryParams::m_inputRasterNoDataValues, te::rp::Segmenter::InputParameters::m_inputRasterPtr, te::rp::Segmenter::SegmenterThreadEntryParams::m_inputRasterSyncPtr, m_instanceInitialized, te::rp::SegmenterSegmentsBlock::m_leftCutOffProfile, te::rp::Segmenter::InputParameters::m_maxBlockSize, te::rp::Segmenter::SegmenterThreadEntryParams::m_maxInputRasterCachedBlocks, te::rp::Segmenter::InputParameters::m_maxSegThreads, te::rst::BandProperty::m_noDataValue, te::rp::Segmenter::SegmenterThreadEntryParams::m_outputParametersPtr, te::rp::Segmenter::OutputParameters::m_outputRasterPtr, te::rp::Segmenter::SegmenterThreadEntryParams::m_outputRasterSyncPtr, te::rp::SegmenterSegmentsBlock::m_rightCutOffProfile, te::rp::Segmenter::OutputParameters::m_rInfo, te::rp::Segmenter::OutputParameters::m_rType, te::rp::Segmenter::SegmenterThreadEntryParams::m_runningThreadsCounterPtr, te::rp::Segmenter::SegmenterThreadEntryParams::m_segmentsIdsManagerPtr, te::rp::SegmenterSegmentsBlock::m_segmentsMatrixXIndex, te::rp::SegmenterSegmentsBlock::m_segmentsMatrixYIndex, te::rp::Segmenter::SegmenterThreadEntryParams::m_segsBlocksMatrixPtr, te::rp::SegmenterSegmentsBlock::m_startX, te::rp::SegmenterSegmentsBlock::m_startY, te::rp::SegmenterSegmentsBlock::m_status, te::rp::Segmenter::InputParameters::m_strategyName, te::rp::SegmenterSegmentsBlock::m_topCutOffProfile, te::rp::SegmenterSegmentsBlock::m_width, te::rst::RasterFactory::make(), te::common::AbstractFactory< te::rp::SegmenterStrategy, std::string, std::less< std::string > >::make(), MIN, te::common::RAccess, te::rp::Matrix< TemplateElementType >::RAMMemPol, te::rp::Matrix< TemplateElementType >::reset(), segmenterThreadEntry(), te::rst::Band::setValue(), TERP_DEBUG_TRUE_OR_THROW, TERP_TRUE_OR_RETURN_FALSE, te::dt::UINT32_TYPE, updateBlockCutOffProfiles(), and te::common::WAccess.
Referenced by te::qt::widgets::SegmenterWizardPage::apply(), te::qt::widgets::SegmenterDialog::on_okPushButton_clicked(), and te::idl::rp::RegionGrowingSegmenter().
|
protected |
Generate the horizontal cutOff prifles for the entire image..
profileCenter | The profile center line. |
inRaster | The input raster. |
inRasterBands | The input raster bands. |
pixelNeighborhoodSize | The pixel neighborhood size over the line transverse to each tile line. |
tileNeighborhoodSize | The buffer size around each tile. |
profileAntiSmoothingFactor | A positive profile anti-smoothing factor. |
profile | The generated profile (each element is a inRaster line index ). |
Definition at line 1080 of file Segmenter.cpp.
References ABS, te::rst::Raster::getNumberOfBands(), te::rst::Raster::getNumberOfColumns(), te::rst::Raster::getNumberOfRows(), te::rst::Raster::getValue(), MAX, MIN, and TERP_DEBUG_TRUE_OR_THROW.
Referenced by execute().
|
protected |
Generate the vertical cutOff prifles for the entire image..
profileCenter | The profile center column. |
inRaster | The input raster. |
inRasterBands | The input raster bands. |
pixelNeighborhoodSize | The pixel neighborhood size over the line transverse to each tile line. |
tileNeighborhoodSize | The buffer size around each tile. |
profileAntiSmoothingFactor | A positive profile anti-smoothing factor. |
profile | The generated profile (each element is a inRaster column index ) |
Definition at line 1224 of file Segmenter.cpp.
References ABS, te::rst::Raster::getNumberOfBands(), te::rst::Raster::getNumberOfColumns(), te::rst::Raster::getNumberOfRows(), te::rst::Raster::getValue(), MAX, MIN, and TERP_DEBUG_TRUE_OR_THROW.
Referenced by execute().
|
virtual |
Initialize the algorithm instance making it ready for execution.
inputParams | Input parameters. |
Implements te::rp::Algorithm.
Definition at line 802 of file Segmenter.cpp.
References te::rst::Raster::getAccessPolicy(), te::rst::Raster::getNumberOfBands(), te::rp::Segmenter::InputParameters::m_blocksOverlapPercent, m_inputParameters, te::rp::Segmenter::InputParameters::m_inputRasterBands, te::rp::Segmenter::InputParameters::m_inputRasterNoDataValues, te::rp::Segmenter::InputParameters::m_inputRasterPtr, m_instanceInitialized, te::common::RAccess, reset(), and TERP_TRUE_OR_RETURN_FALSE.
Referenced by te::qt::widgets::SegmenterWizardPage::apply(), te::qt::widgets::SegmenterDialog::on_okPushButton_clicked(), and te::idl::rp::RegionGrowingSegmenter().
|
virtual |
Returns true if the algorithm instance is initialized and ready for execution.
Implements te::rp::Algorithm.
Definition at line 841 of file Segmenter.cpp.
References m_instanceInitialized.
|
virtual |
Clear all internal allocated objects and reset the algorithm to its initial state.
Implements te::rp::Algorithm.
Definition at line 796 of file Segmenter.cpp.
References m_inputParameters, m_instanceInitialized, and te::rp::Segmenter::InputParameters::reset().
Referenced by initialize(), te::rp::Segmenter::InputParameters::InputParameters(), te::rp::Segmenter::InputParameters::operator=(), te::rp::Segmenter::OutputParameters::operator=(), te::rp::Segmenter::OutputParameters::OutputParameters(), te::rp::Segmenter::InputParameters::~InputParameters(), and te::rp::Segmenter::OutputParameters::~OutputParameters().
|
staticprotected |
Segmenter thread entry.
paramsPtr | A pointer to the segmenter thread parameters. |
Definition at line 894 of file Segmenter.cpp.
References te::rp::SegmenterSegmentsBlock::BlockNotProcessed, te::rp::SegmenterSegmentsBlock::BlockSegmented, te::rp::SegmenterSegmentsBlock::BlockUnderSegmentation, te::rp::Matrix< TemplateElementType >::getColumnsNumber(), te::rp::Matrix< TemplateElementType >::getLinesNumber(), te::rp::Segmenter::InputParameters::getSegStrategyParams(), te::rp::Segmenter::SegmenterThreadEntryParams::m_abortSegmentationFlagPtr, te::rp::Segmenter::SegmenterThreadEntryParams::m_blockProcessedSignalMutexPtr, te::rp::Segmenter::SegmenterThreadEntryParams::m_blockProcessedSignalPtr, te::rp::Segmenter::SegmenterThreadEntryParams::m_enableStrategyProgress, te::rp::Segmenter::SegmenterThreadEntryParams::m_generalMutexPtr, te::rp::Segmenter::SegmenterThreadEntryParams::m_inputParameters, te::rp::Segmenter::SegmenterThreadEntryParams::m_inputRasterBandMaxValues, te::rp::Segmenter::SegmenterThreadEntryParams::m_inputRasterBandMinValues, te::rp::Segmenter::InputParameters::m_inputRasterBands, te::rp::Segmenter::SegmenterThreadEntryParams::m_inputRasterNoDataValues, te::rp::Segmenter::SegmenterThreadEntryParams::m_inputRasterSyncPtr, te::rp::Segmenter::SegmenterThreadEntryParams::m_maxInputRasterCachedBlocks, te::rp::Segmenter::SegmenterThreadEntryParams::m_outputParametersPtr, te::rp::Segmenter::SegmenterThreadEntryParams::m_outputRasterSyncPtr, te::rp::Segmenter::SegmenterThreadEntryParams::m_runningThreadsCounterPtr, te::rp::Segmenter::SegmenterThreadEntryParams::m_segmentsIdsManagerPtr, te::rp::Segmenter::SegmenterThreadEntryParams::m_segsBlocksMatrixPtr, te::rp::SegmenterSegmentsBlock::m_status, te::rp::Segmenter::InputParameters::m_strategyName, te::common::AbstractFactory< te::rp::SegmenterStrategy, std::string, std::less< std::string > >::make(), TERP_DEBUG_TRUE_OR_THROW, and TERP_TRUE_OR_THROW.
Referenced by execute().
|
protected |
Update the block cutOff profiles using the full image profiles.
imageVerticalProfiles | The generated horizontal profiles (empty profiles also will be accepted). |
horizontalProfiles | The generated vertical profiles (empty profiles also will be accepted). |
segmentsBlock | The block to update. |
Definition at line 1368 of file Segmenter.cpp.
References te::rp::SegmenterSegmentsBlock::m_bottomCutOffProfile, te::rp::SegmenterSegmentsBlock::m_height, te::rp::SegmenterSegmentsBlock::m_leftCutOffProfile, te::rp::SegmenterSegmentsBlock::m_rightCutOffProfile, te::rp::SegmenterSegmentsBlock::m_segmentsMatrixXIndex, te::rp::SegmenterSegmentsBlock::m_segmentsMatrixYIndex, te::rp::SegmenterSegmentsBlock::m_startX, te::rp::SegmenterSegmentsBlock::m_startY, te::rp::SegmenterSegmentsBlock::m_topCutOffProfile, te::rp::SegmenterSegmentsBlock::m_width, MAX, and MIN.
Referenced by execute().
|
protected |
Segmenter execution parameters.
Definition at line 257 of file Segmenter.h.
Referenced by calcBestBlockSize(), createCutOffLinesTiff(), execute(), initialize(), reset(), and te::rp::Segmenter::SegmenterThreadEntryParams::SegmenterThreadEntryParams().
|
protected |
Definition at line 255 of file Segmenter.h.
Referenced by execute(), initialize(), isInitialized(), reset(), and Segmenter().