| TerraLib 4.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Examples

- Class List
- Class Index
- Class Hierarchy
- Class Members

Classes | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions
TePDIParallelSegmenter Class Reference
Segmentation algorithms.

Multi-threaded image segmenter. More...

`#include <TePDIParallelSegmenter.hpp>`

Inheritance diagram for TePDIParallelSegmenter:

List of all members.

## Classes

class | GroupDataThreadEntryParams
| The parameters passed to the groupDataThreadEntry method. More...
class | SegmenterThreadEntryParams
| The parameters passed to the segmenterThreadEntry method. More...

## Public Member Functions

| TePDIParallelSegmenter ()
| ~TePDIParallelSegmenter ()
bool | CheckParameters (const TePDIParameters &parameters) const
| Checks if the supplied parameters fits the requirements of each PDI algorithm implementation.

## Protected Types

typedef TePDIMatrix < TePDIParaSegSegmentsBlock > | SegmentsBlocksMatrixT

## Protected Member Functions

bool | RunImplementation ()
| Runs the current algorithm implementation.
void | ResetState (const TePDIParameters &params)
| Reset the internal state to the initial state.
bool | calcBestBlockSize (const unsigned int totalImageLines, const unsigned int totalImageCols, const unsigned int minBlockPixels, const unsigned int maxBlockPixels, unsigned int &blockWidth, unsigned int &blockHeight) const
| Calc the best sub-image block size for each thread to process.

## Static Protected Member Functions

static bool | segmenterThreadEntry (void *paramsPtr)
| Segmenter thread entry.
static bool | groupDataThreadEntry (void *paramsPtr)
| Group segmented data thread entry.
static bool | flushBlock (TePDIParaSegSegmentsBlock &currBlock, TeRaster &outRaster, TePDIPIManager &progress)
| Flush block to output raster.

## Detailed Description

Multi-threaded image segmenter.

This class acts just like a threaded engine that splits the input image into small blocks to be processed by the choosen segmentation strategy. All blocks are segmented independently and the result will be merged (if possible) at the end.

Author:
  Emiliano F. Castejon <castejon@dpi.inpe.br>.

Note:
  The required parameters are:

Parameters:

  input_image_ptr | (TePDITypes::TePDIRasterPtrType) - The input image pointer.
  input_channels | ( std::vector< unsigned int > ) - Bands/channels to process from input_image.
  strategy_name | (std::string) - Parallel segmenter strategy name (see each TePDIParaSegStrategy inherited classes documentation reference).
  output_image_ptr | (TePDITypes::TePDIRasterPtrType) - The output labeled image.

Note:
  The optional parameters are:

Parameters:

  strategy_params | (TePDIParameters) - Segmenter strategy specific parameters (see each TePDIParaSegStrategy inherited classes documentation reference).
  max_block_size | (unsigned int) - The input image will be split into blocks with this for processing, this parameter tells the maximum block lateral size (width/height), the default: automatic width following the current system resources and physical processors number).
  max_seg_threads | (unsigned int) - The maximum number of concurrent segmenter threads (default:the number of physical processors, minimum:0 - multi-thread disabled).
  merge_adjacent_blocks | (bool) - All image adjacent blocks boder segments will be merged, when possible (default:true)

Note:
  Since this algorithm uses multi-thread processing the user must be aware that some image decoders do not offer support for multi-threaded processing.

Examples:

  TePDIParallelSegmenter_test.cpp.

## Member Typedef Documentation

typedef TePDIMatrix< TePDIParaSegSegmentsBlock > TePDIParallelSegmenter::SegmentsBlocksMatrixT`[protected]`

Segments blocks matrix type definition

## Constructor & Destructor Documentation

TePDIParallelSegmenter::TePDIParallelSegmenter | ( |  | ) |

TePDIParallelSegmenter::~TePDIParallelSegmenter | ( |  | ) |

## Member Function Documentation

bool TePDIParallelSegmenter::calcBestBlockSize | ( | const unsigned int | totalImageLines,
|  | const unsigned int | totalImageCols,
|  | const unsigned int | minBlockPixels,
|  | const unsigned int | maxBlockPixels,
|  | unsigned int & | blockWidth,
|  | unsigned int & | blockHeight
| ) |  | const`[protected]`

Calc the best sub-image block size for each thread to process.

Parameters:

  totalImageLines | The total original full image lines.
  totalImageCols | The total original full image columns.
  minBlockPixels | The minimun allowed pixels number for each block.
  maxBlockPixels | The maximum allowed pixels number for each block.
  blockWidth | The calculated block width.
  blockHeight | The calculated block height.

Returns:
  true if OK, false on errors.

bool TePDIParallelSegmenter::CheckParameters | ( | const TePDIParameters & | parameters | ) | const`[virtual]`

Checks if the supplied parameters fits the requirements of each PDI algorithm implementation.

Note:
  Error log messages must be generated. No exceptions generated.

Parameters:

  parameters | The parameters to be checked.

Returns:
  true if the parameters are OK. false if not.

Implements TePDIAlgorithm.

bool TePDIParallelSegmenter::flushBlock | ( | TePDIParaSegSegmentsBlock & | currBlock,
|  | TeRaster & | outRaster,
|  | TePDIPIManager & | progress
| ) |  | `[static, protected]`

Flush block to output raster.

Parameters:

  currBlock | The current block that will be flushed.
  outRaster | The output raster.
  progress | Progress interface instance to increment.

Returns:
  true if OK, false on errors.

Note:
  The block unused memory will be freed as well segments with no more references left.

bool TePDIParallelSegmenter::groupDataThreadEntry | ( | void * | paramsPtr | ) | `[static, protected]`

Group segmented data thread entry.

Parameters:

  paramsPtr | A pointer to a casted GroupDataThreadEntryParams.

Returns:
  true if OK, false on errors.

void TePDIParallelSegmenter::ResetState | ( | const TePDIParameters & | params | ) | `[protected, virtual]`

Reset the internal state to the initial state.

Parameters:

  params | The new parameters referente at initial state.

Implements TePDIAlgorithm.

bool TePDIParallelSegmenter::RunImplementation | ( |  | ) | `[protected, virtual]`

Runs the current algorithm implementation.

Returns:
  true if OK. false on error.

Implements TePDIAlgorithm.

bool TePDIParallelSegmenter::segmenterThreadEntry | ( | void * | paramsPtr | ) | `[static, protected]`

Segmenter thread entry.

Parameters:

  paramsPtr | A pointer to a casted SegmenterThreadEntryParams.

Returns:
  true if OK, false on errors.

The documentation for this class was generated from the following files:

- E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/image_processing/TePDIParallelSegmenter.hpp
- E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/image_processing/TePDIParallelSegmenter.cpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines