26 #include "../common/progress/TaskProgress.h" 31 segmenterDummyStrategyFactoryInstance;
58 const std::vector< unsigned int >& inputRasterBands,
59 const std::vector< std::complex< double > >& inputRasterNoDataValues,
60 const std::vector< std::complex< double > >& inputRasterBandMinValues,
61 const std::vector< std::complex< double > >& inputRasterBandMaxValues,
63 const unsigned int outputRasterBand,
64 const bool enableProgressInterface )
65 throw( te::rp::Exception )
67 assert( inputRasterBands.size() == inputRasterNoDataValues.size() );
68 assert( inputRasterNoDataValues.size() == inputRasterBandMinValues.size() );
69 assert( inputRasterBandMinValues.size() == inputRasterBandMaxValues.size() );
70 assert( block2ProcessInfo.m_topCutOffProfile.size() == block2ProcessInfo.m_width );
71 assert( block2ProcessInfo.m_bottomCutOffProfile.size() == block2ProcessInfo.m_width );
72 assert( block2ProcessInfo.m_leftCutOffProfile.size() == block2ProcessInfo.m_height );
73 assert( block2ProcessInfo.m_rightCutOffProfile.size() == block2ProcessInfo.m_height );
76 segmenterIdsManager.getNewID();
80 std::unique_ptr< te::common::TaskProgress > progressPtr;
81 if( enableProgressInterface )
84 progressPtr->setTotalSteps( block2ProcessInfo.m_height );
85 progressPtr->setMessage(
"Segmentation" );
90 unsigned int blkCol = 0;
92 unsigned int inputRasterBandsIdx = 0;
93 const unsigned int inputRasterBandsSize =
static_cast<unsigned int>(inputRasterBands.size());
94 bool rasterValuesAreValid =
false;
96 for(
unsigned int blkLine = 0 ; blkLine < block2ProcessInfo.m_height ; ++blkLine )
98 for( blkCol = 0 ; blkCol < block2ProcessInfo.m_width ; ++blkCol )
100 rasterValuesAreValid =
true;
102 for( inputRasterBandsIdx = 0 ; inputRasterBandsIdx <
103 inputRasterBandsSize ; ++inputRasterBandsIdx )
105 inputRaster.getValue( blkCol + block2ProcessInfo.m_startX, blkLine +
106 block2ProcessInfo.m_startY, value,
107 inputRasterBands[ inputRasterBandsIdx ] );
109 if( value == inputRasterNoDataValues[ inputRasterBandsIdx ] )
111 rasterValuesAreValid =
false;
119 ( blkLine >= block2ProcessInfo.m_topCutOffProfile[ blkCol ] )
121 ( blkLine <= block2ProcessInfo.m_bottomCutOffProfile[ blkCol ] )
123 ( blkCol >= block2ProcessInfo.m_leftCutOffProfile[ blkLine ] )
125 ( blkCol <= block2ProcessInfo.m_rightCutOffProfile[ blkLine ] )
128 outputRaster.setValue( blkCol + block2ProcessInfo.m_startX,
129 blkLine + block2ProcessInfo.m_startY, segmentId, outputRasterBand );
133 if( enableProgressInterface )
135 if( ! progressPtr->isActive() )
140 progressPtr->pulse();
148 const unsigned int bandsToProcess,
const unsigned int pixelsNumber )
const 150 return (
double)(
sizeof(double) * bandsToProcess * pixelsNumber );
Segmenter segments IDs manager.
Dummy strategy (just for testing purposes).
bool execute(SegmenterIdsManager &segmenterIdsManager, const te::rp::SegmenterSegmentsBlock &block2ProcessInfo, const te::rst::Raster &inputRaster, const std::vector< unsigned int > &inputRasterBands, const std::vector< std::complex< double > > &inputRasterNoDataValues, const std::vector< std::complex< double > > &inputRasterBandMinValues, const std::vector< std::complex< double > > &inputRasterBandMaxValues, te::rst::Raster &outputRaster, const unsigned int outputRasterBand, const bool enableProgressInterface)
Executes the segmentation strategy over region delimited by the given block.
BlocksMergingMethod getBlocksMergingMethod() const
Return the strategy blocks merging method.
~SegmenterDummyStrategyFactory()
bool initialize(SegmenterStrategyParameters const *const strategyParams)
Initialize the segmentation strategy.
SegmenterDummyStrategyFactory()
Base exception class for plugin module.
This class can be used to inform the progress of a task.
unsigned int getOptimalBlocksOverlapSize() const
Returns a optimal blocks overlap size (number of border pixels overlapped between blocks...
double getMemUsageEstimation(const unsigned int bandsToProcess, const unsigned int pixelsNumber) const
Returns a memory estimation (bytes).
~SegmenterDummyStrategy()
bool shouldComputeMinMaxValues() const
Returns if the min and max pixel values should be computed.
Raster dummy segmenter strategy factory.
void reset()
Clear all internal allocated resources and go back to the initial not-initialized state...
Segmenter Strategy Parameters.
Raster segmenter strategy factory base class.
unsigned int SegmentIdDataType
An abstract class for raster data strucutures.
Raster segmenter strategy base class.
te::rp::SegmenterStrategy * build()
Concrete factories (derived from this one) must implement this method in order to create objects...
BlocksMergingMethod
Blocks merging method.
Segmenter segments block description class.
virtual void reset()
Clear all internal allocated resources and go back to the initial not-initialized state...
Dummy strategy (just for testing purposes).