| 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 | Protected Attributes
TePDIArithmetic Class Reference
General purpose algorithms.

Performs arithmetic operation over raster data. More...

`#include <TePDIArithmetic.hpp>`

Inheritance diagram for TePDIArithmetic:

List of all members.

## Classes

class | ExecStackElement
| Execution stack element. More...

## Public Member Functions

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

## Protected Types

typedef std::stack < ExecStackElement > | ExecStackT

## Protected Member Functions

bool | RunImplementation ()
| Runs the current algorithm implementation.
void | ResetState (const TePDIParameters &params)
| Reset the internal state to the initial state.
bool | executeString (const std::string &aStr, const TePDITypes::TePDIRasterVectorType &inRasters, TePDITypes::TePDIRasterPtrType &outRaster, bool generateOutput) const
| Execute the automata parsing the given input string.
void | inFix2PostFix (const std::vector< std::string > &input, std::vector< std::string > &output) const
| Convert the input tokens vector from the infix notation to postfix notation.
void | printTokens (const std::vector< std::string > &input) const
| Print tokens to stout.
bool | isOperator (const std::string &inputToken) const
| Returns true if the given token is an operator.
bool | isBinaryOperator (const std::string &inputToken) const
| Returns true if the given token is a binary operator.
bool | isUnaryOperator (const std::string &inputToken) const
| Returns true if the given token is a unary operator.
bool | op1HasGreaterOrEqualPrecedence (const std::string &operator1, const std::string &operator2) const
| Returns true if operator1 has greater of equal precedence over operator2.
bool | isRasterBandToken (const std::string &token, unsigned int &rasterIdx, unsigned int &bandIdx) const
| Returns true if the given token is a raster data token.
bool | execBinaryOperator (const std::string &token, ExecStackT &execStack, bool generateOutput) const
| Execute the given binary operator using the current given execution stack.
bool | execUnaryOperator (const std::string &token, ExecStackT &execStack, bool generateOutput) const
| Execute the given unary operator using the current given execution stack.
bool | isRealNumberToken (const std::string &token, double &realValue) const
| Returns true if the given token is a real number.
bool | allocResultRaster (unsigned int nLines, unsigned int nCols, TePDITypes::TePDIRasterPtrType &rasterPtr) const
| Allocate a new RAM memory raster.
void | getTokensStrs (const std::string &inputStr, std::vector< std::string > &outTokens) const
| Split the input string into a vector of token strings.

## Protected Attributes

TePDIPIManager | progress_

## Detailed Description

Performs arithmetic operation over raster data.

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

Note:
  The general required parameters are:

Parameters:

  input_rasters | ( TePDITypes::TePDIRasterVectorType ) - A vector of all used rasters pointers ( NOTE: All rasters must have the same number of lines/columns ).
  arithmetic_string | ( std::string ) - Arithmetic string to execute. It must be formed by a combination of the folowing elements: * Operators: +, -, *, / * Real Numbers * Raster bands: R0:1, R0:1, R1:0, .... (R0:1 is a reference to the first raster - with index 0 - from input_rasters, second band - with index 1). An example of an arithmetic string: "( R0:0 + 1.0 ) / R1:0".
  output_raster | (TePDITypes::TePDIRasterPtrType) - The output raster pointer.

Note:
  The following parameters are optional:

Parameters:

  normalize_output | (int) - If present(with any value) an output values normalization will be performed to fit the allowed values range dictated by the output_raster data type (default:no normalization performed).

Note:
  The input raster with index 0 will be used as reference for projection, number of lines, number of columns and pixel resolution.

Examples:

  TePDIArithmetic_test.cpp.

## Member Typedef Documentation

typedef std::stack< ExecStackElement > TePDIArithmetic::ExecStackT`[protected]`

## Constructor & Destructor Documentation

TePDIArithmetic::TePDIArithmetic | ( |  | ) |

TePDIArithmetic::~TePDIArithmetic | ( |  | ) |

## Member Function Documentation

bool TePDIArithmetic::allocResultRaster | ( | unsigned int | nLines,
|  | unsigned int | nCols,
|  | TePDITypes::TePDIRasterPtrType & | rasterPtr
| ) |  | const`[protected]`

Allocate a new RAM memory raster.

Parameters:

  nLines | Number of raster lines.
  nCols | Number of raster columns.
  rasterPtr | The output raster pointer.

Returns:
  Returns true if OK, false on errors.

bool TePDIArithmetic::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 TePDIArithmetic::execBinaryOperator | ( | const std::string & | token,
|  | ExecStackT & | execStack,
|  | bool | generateOutput
| ) |  | const`[protected]`

Execute the given binary operator using the current given execution stack.

Parameters:

  token | Operator token.
  execStack | Execution stack.
  generateOutput | if true the execution will generate valid output data, if false only dummy stack elements will be generated.

Returns:
  true if OK, false on errors..

bool TePDIArithmetic::execUnaryOperator | ( | const std::string & | token,
|  | ExecStackT & | execStack,
|  | bool | generateOutput
| ) |  | const`[protected]`

Execute the given unary operator using the current given execution stack.

Parameters:

  token | Operator token.
  execStack | Execution stack.
  generateOutput | if true the execution will generate valid output data, if false only dummy stack elements will be generated.

Returns:
  true if OK, false on errors..

bool TePDIArithmetic::executeString | ( | const std::string & | aStr,
|  | const TePDITypes::TePDIRasterVectorType & | inRasters,
|  | TePDITypes::TePDIRasterPtrType & | outRaster,
|  | bool | generateOutput
| ) |  | const`[protected]`

Execute the automata parsing the given input string.

Parameters:

  aStr | The input arithmetic expression string.
  inRasters | Input rasters pointers.
  outRaster | Output raster pointer (pre-initiated).
  generateOutput | If true, the output raster data will be generated, if false only the automata execution will be performed..

void TePDIArithmetic::getTokensStrs | ( | const std::string & | inputStr,
|  | std::vector< std::string > & | outTokens
| ) |  | const`[protected]`

Split the input string into a vector of token strings.

Parameters:

  inputStr | The input string.
  outTokens | The generated output tokens vector.

void TePDIArithmetic::inFix2PostFix | ( | const std::vector< std::string > & | input,
|  | std::vector< std::string > & | output
| ) |  | const`[protected]`

Convert the input tokens vector from the infix notation to postfix notation.

Parameters:

  input | The input tokens vector.
  output | The output tokens vector.

bool TePDIArithmetic::isBinaryOperator | ( | const std::string & | inputToken | ) | const`[protected]`

Returns true if the given token is a binary operator.

Parameters:

  inputToken | Input token.

Returns:
  Returns true if the given token is a binary operator.

bool TePDIArithmetic::isOperator | ( | const std::string & | inputToken | ) | const`[protected]`

Returns true if the given token is an operator.

Parameters:

  inputToken | Input token.

Returns:
  Returns true if the given token is an operator.

bool TePDIArithmetic::isRasterBandToken | ( | const std::string & | token,
|  | unsigned int & | rasterIdx,
|  | unsigned int & | bandIdx
| ) |  | const`[protected]`

Returns true if the given token is a raster data token.

Parameters:

  token | Input token.
  rasterIdx | The output converted raster index value.
  bandIdx | The output converted band index value.

Returns:
  Returns true if the given token is a raster data token.

bool TePDIArithmetic::isRealNumberToken | ( | const std::string & | token,
|  | double & | realValue
| ) |  | const`[protected]`

Returns true if the given token is a real number.

Parameters:

  token | Input token.
  realValue | The output converted value.

Returns:
  Returns true if the given token is a real number.

bool TePDIArithmetic::isUnaryOperator | ( | const std::string & | inputToken | ) | const`[protected]`

Returns true if the given token is a unary operator.

Parameters:

  inputToken | Input token.

Returns:
  Returns true if the given token is a unary operator.

bool TePDIArithmetic::op1HasGreaterOrEqualPrecedence | ( | const std::string & | operator1,
|  | const std::string & | operator2
| ) |  | const`[protected]`

Returns true if operator1 has greater of equal precedence over operator2.

Parameters:

  operator1 | Operator1 input token.
  operator2 | Operator2 input token.

Returns:
  Returns true if operator1 has greater of equal precedence over operator2.

void TePDIArithmetic::printTokens | ( | const std::vector< std::string > & | input | ) | const`[protected]`

Print tokens to stout.

Parameters:

  input | The input tokens vector.

void TePDIArithmetic::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 TePDIArithmetic::RunImplementation | ( |  | ) | `[protected, virtual]`

Runs the current algorithm implementation.

Returns:
  true if OK. false on error.

Implements TePDIAlgorithm.

## Member Data Documentation

TePDIPIManager TePDIArithmetic::progress_`[mutable, protected]`

Internal progress manager instance.

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

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

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines