26 #include "../common/progress/TaskProgress.h"
31 segmenterDummyStrategyFactoryInstance;
49 throw( te::rp::Exception )
62 const std::vector< unsigned int >& inputRasterBands,
63 const std::vector< double >& inputRasterNoDataValues,
64 const std::vector< double >& inputRasterBandMinValues,
65 const std::vector< double >& inputRasterBandMaxValues,
67 const unsigned int outputRasterBand,
68 const bool enableProgressInterface )
69 throw( te::rp::Exception )
71 assert( inputRasterBands.size() == inputRasterNoDataValues.size() );
72 assert( inputRasterNoDataValues.size() == inputRasterBandMinValues.size() );
73 assert( inputRasterBandMinValues.size() == inputRasterBandMaxValues.size() );
74 assert( block2ProcessInfo.m_topCutOffProfile.size() == block2ProcessInfo.m_width );
75 assert( block2ProcessInfo.m_bottomCutOffProfile.size() == block2ProcessInfo.m_width );
76 assert( block2ProcessInfo.m_leftCutOffProfile.size() == block2ProcessInfo.m_height );
77 assert( block2ProcessInfo.m_rightCutOffProfile.size() == block2ProcessInfo.m_height );
80 segmenterIdsManager.getNewID();
84 std::auto_ptr< te::common::TaskProgress > progressPtr;
85 if( enableProgressInterface )
88 progressPtr->setTotalSteps( block2ProcessInfo.m_height );
89 progressPtr->setMessage(
"Segmentation" );
94 unsigned int blkCol = 0;
96 unsigned int inputRasterBandsIdx = 0;
97 const unsigned int inputRasterBandsSize = inputRasterBands.size();
98 bool rasterValuesAreValid =
false;
100 for(
unsigned int blkLine = 0 ; blkLine < block2ProcessInfo.m_height ; ++blkLine )
102 for( blkCol = 0 ; blkCol < block2ProcessInfo.m_width ; ++blkCol )
104 rasterValuesAreValid =
true;
106 for( inputRasterBandsIdx = 0 ; inputRasterBandsIdx <
107 inputRasterBandsSize ; ++inputRasterBandsIdx )
109 inputRaster.getValue( blkCol + block2ProcessInfo.m_startX, blkLine +
110 block2ProcessInfo.m_startY, value,
111 inputRasterBands[ inputRasterBandsIdx ] );
113 if( value == inputRasterNoDataValues[ inputRasterBandsIdx ] )
115 rasterValuesAreValid =
false;
123 ( blkLine >= block2ProcessInfo.m_topCutOffProfile[ blkCol ] )
125 ( blkLine <= block2ProcessInfo.m_bottomCutOffProfile[ blkCol ] )
127 ( blkCol >= block2ProcessInfo.m_leftCutOffProfile[ blkLine ] )
129 ( blkCol <= block2ProcessInfo.m_rightCutOffProfile[ blkLine ] )
132 outputRaster.setValue( blkCol + block2ProcessInfo.m_startX,
133 blkLine + block2ProcessInfo.m_startY, segmentId, outputRasterBand );
137 if( enableProgressInterface )
139 if( ! progressPtr->isActive() )
144 progressPtr->pulse();
152 const unsigned int bandsToProcess,
const unsigned int pixelsNumber )
const
154 return (
double)(
sizeof(double) * bandsToProcess * pixelsNumber );
Segmenter segments IDs manager.
Dummy strategy (just for testing purposes).
~SegmenterDummyStrategyFactory()
bool initialize(SegmenterStrategyParameters const *const strategyParams)
Initialize the segmentation strategy.
SegmenterDummyStrategyFactory()
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()
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.
bool execute(SegmenterIdsManager &segmenterIdsManager, const te::rp::SegmenterSegmentsBlock &block2ProcessInfo, const te::rst::Raster &inputRaster, const std::vector< unsigned int > &inputRasterBands, const std::vector< double > &inputRasterNoDataValues, const std::vector< double > &inputRasterBandMinValues, const std::vector< double > &inputRasterBandMaxValues, te::rst::Raster &outputRaster, const unsigned int outputRasterBand, const bool enableProgressInterface)
Executes the segmentation strategy over region delimited by the given block.
te::rp::SegmenterStrategy * build()
Concrete factories (derived from this one) must implement this method in order to create objects...
Segmenter segments block description class.
Dummy strategy (just for testing purposes).