TerraLib 4.1
TePDIParaSegRegGrowStrategy Class Reference

Multi-threaded image segmenter Region Growing strategy. More...

#include <TePDIParaSegRegGrowStrategy.hpp>

Inheritance diagram for TePDIParaSegRegGrowStrategy:
TePDIParaSegStrategy

List of all members.

Classes

class  MergingSegmentInfo
 Information about a candidate segment for merging. More...
class  Segment
 Information about one segment. More...

Public Member Functions

 TePDIParaSegRegGrowStrategy (const TePDIParaSegStrategyParams &params)
 ~TePDIParaSegRegGrowStrategy ()
bool execute (const RasterDataVecT &rasterDataVector, TePDIParaSegSegmentsBlock::SegmentsPointersMatrixT &outSegsMatrix)
 Execute segmentation following the supplied strategy specific parameters.
bool setParameters (const TePDIParameters &params)
 Set the specific strategy parameters.
bool mergeSegments (TePDIParaSegSegmentsBlock::SegmentsPointersMatrixT &centerMatrix, TePDIParaSegSegmentsBlock::SegmentsPointersMatrixT *topMatrixPtr, TePDIParaSegSegmentsBlock::SegmentsPointersMatrixT *leftMatrixPtr)
 Merge adjacent matrix border segments.
double getMemUsageFactor () const
 Returns a positive memory use weight factor.

Static Public Member Functions

static bool staticMergeSegments (TePDIParaSegSegmentsBlock::SegmentsPointersMatrixT &centerMatrix, TePDIParaSegSegmentsBlock::SegmentsPointersMatrixT *topMatrixPtr, TePDIParaSegSegmentsBlock::SegmentsPointersMatrixT *leftMatrixPtr, double eucTreshold)
template<class StrategyTemplateT >
static bool createSegsBlkFromLImg (const RasterDataVecT &rasterDataVector, TeRaster &labelRaster, StrategyTemplateT *stratPtr, TePDIParaSegSegmentsBlock::SegmentsPointersMatrixT &outSegsMatrix)
 Create a segments matrix from a label image.

Protected Types

typedef std::vector
< MergingSegmentInfo
MergingSegmentInfoVecT
 Type definition for a vector of canditate merging segments information vector.

Static Protected Member Functions

static bool staticLocateMergingSegments (Segment const *inputSegPtr, TePDIParaSegSegmentsBlock::SegmentsPointersMatrixT const *inputSegMtxPtr, const MergingSegmentInfoVecT &candidateSegmentsVec, std::vector< unsigned int > &locatedSegsIndexes, double eucTreshold)
 Locate, among the given candidate segments, those wich can be merged with the segment inputSegPtr.

Protected Attributes

TePDITypes::TePDIRasterPtrType inputRasterPtr_
TePDITypes::TePDIRasterPtrType outputRasterPtr_
TePDIParameters segParams_
TePDIRegGrowSeg segmenter_
double eucTreshold_

Detailed Description

Multi-threaded image segmenter Region Growing strategy.

Author:
Emiliano F. Castejon <castejon@dpi.inpe.br>.
Note:
The strategy name that must be used to construct an instance of this class is "RegionGrowing".
The general required parameters :
Parameters:
euc_treshold(double) - Maximum eclidean distance between each segment (This parameter is used to merge adjacent segments from adjacent image blocks).
area_min(int) - cell pixel size min value.

Member Typedef Documentation

Type definition for a vector of canditate merging segments information vector.


Constructor & Destructor Documentation

TePDIParaSegRegGrowStrategy::TePDIParaSegRegGrowStrategy ( const TePDIParaSegStrategyParams params)
TePDIParaSegRegGrowStrategy::~TePDIParaSegRegGrowStrategy ( )

Member Function Documentation

template<class StrategyTemplateT >
bool TePDIParaSegRegGrowStrategy::createSegsBlkFromLImg ( const RasterDataVecT rasterDataVector,
TeRaster labelRaster,
StrategyTemplateT *  stratPtr,
TePDIParaSegSegmentsBlock::SegmentsPointersMatrixT outSegsMatrix 
) [static]

Create a segments matrix from a label image.

Parameters:
rasterDataVectorThe original input raster data vector.
labelRasterThe label image raster.
stratPtrA pointer to the strategy calling this method..
outSegsMatrixA reference to the output generated segments matrix.
Returns:
true if OK, false on errors.
Note:
This method is templated by the strategy type inherithed from TePDIParaSegStrategy.
bool TePDIParaSegRegGrowStrategy::execute ( const RasterDataVecT rasterDataVector,
TePDIParaSegSegmentsBlock::SegmentsPointersMatrixT outSegsMatrix 
) [virtual]

Execute segmentation following the supplied strategy specific parameters.

This method will be called many times as required to the same strategy instance to execute segmentation on each image block.

Parameters:
rasterDataVectorThe input raster data vector (each vector element represents one raster band/channel).
outSegsMatrixThe generated output segments matrix.
Returns:
true if OK, false on errors.
Note:
The generated segments IDs must be acquired by using the TePDIParaSegStrategy::acquireNewSegID() method.
The generated segments reference counters must be initiated with value 1.

Implements TePDIParaSegStrategy.

double TePDIParaSegRegGrowStrategy::getMemUsageFactor ( ) const [inline, virtual]

Returns a positive memory use weight factor.

This parameter is used by the parallel segmenter to guess the sub-image blocks size.

Returns:
A memory use weight factor (default:1,0).

Implements TePDIParaSegStrategy.

bool TePDIParaSegRegGrowStrategy::mergeSegments ( TePDIParaSegSegmentsBlock::SegmentsPointersMatrixT centerMatrix,
TePDIParaSegSegmentsBlock::SegmentsPointersMatrixT topMatrixPtr,
TePDIParaSegSegmentsBlock::SegmentsPointersMatrixT leftMatrixPtr 
) [virtual]

Merge adjacent matrix border segments.

This method will be called many times as required to the same strategy instance to merge the entire label image incrementally; on each call references to 3 adjacent image segments blocks will be passed as shown ahead.

          ________________________________
          |     |     |      |     |     |
          ________________________________
          |     |     |top   |     |     |
          ________________________________
          |     |left |center|     |     |          
          _______________________________
          |     |     |      |     |     |          
          ________________________________          
Parameters:
centerMatrixA reference to the image block matrix located at the merging region center.
topMatrixPtrA pointer to the image block matrix located at the merging region top or null if this block does not exists.
leftMatrixPtrA pointer to the image block matrix located at the merging region left or null if this block does not exists.
Returns:
true if OK, false on errors.

Implements TePDIParaSegStrategy.

bool TePDIParaSegRegGrowStrategy::setParameters ( const TePDIParameters params) [virtual]

Set the specific strategy parameters.

This method will be called once for each strategy instance created.

Parameters:
paramsA reference to the new parameters.
Returns:
true if OK, false on errors.

Implements TePDIParaSegStrategy.

bool TePDIParaSegRegGrowStrategy::staticLocateMergingSegments ( Segment const *  inputSegPtr,
TePDIParaSegSegmentsBlock::SegmentsPointersMatrixT const *  inputSegMtxPtr,
const MergingSegmentInfoVecT candidateSegmentsVec,
std::vector< unsigned int > &  locatedSegsIndexes,
double  eucTreshold 
) [static, protected]

Locate, among the given candidate segments, those wich can be merged with the segment inputSegPtr.

Parameters:
inputSegPtrA pointer to the segment to merge with the located candidate.
inputSegMtxPtrInput segment matrix pointer.
candidateSegmentsVecThe candidate segments information vector.
locatedSegsIndexesThe selected candidate segment indexes inside candidateSegmentsVec ordered from the best candidate (first locatedSegInfoIndexes vector element ) to the worse canditate (last locatedSegInfoIndexes vector element).
eucTresholdMax euclidean distance between each segment.
Returns:
true if one cadidate was located, false if no candidate was located.
bool TePDIParaSegRegGrowStrategy::staticMergeSegments ( TePDIParaSegSegmentsBlock::SegmentsPointersMatrixT centerMatrix,
TePDIParaSegSegmentsBlock::SegmentsPointersMatrixT topMatrixPtr,
TePDIParaSegSegmentsBlock::SegmentsPointersMatrixT leftMatrixPtr,
double  eucTreshold 
) [static]

Member Data Documentation

Maximum allowed euclidean distance parameter

A raster generated from the input raster data vector.

A raster generated from the segmentation.

Segmentation algorithm parameters


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines