| TerraLib 4.1

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

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

Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
TePDIStatistic Class Reference
General purpose algorithms.

This is the class for statistic calcules over raster data. More...

`#include <TePDIStatistic.hpp>`

Inheritance diagram for TePDIStatistic:

List of all members.

## Public Types

typedef TeSharedPtr < TePDIStatistic > | pointer
typedef const TeSharedPtr < TePDIStatistic > | const_pointer

## Public Member Functions

| TePDIStatistic ()
| Default Constructor.
| ~TePDIStatistic ()
| Default Destructor.
bool | CheckParameters (const TePDIParameters &parameters) const
| Checks if the supplied parameters fits the requirements of each PDI algorithm implementation.
const TePDIHistogram & | getHistogram (unsigned int raster_index, unsigned int pol_index=0)
| Generates the histogram for a given raster/band.
const TePDIJointHistogram & | getJointHistogram (unsigned int raster1_index, unsigned int raster2_index, unsigned int pol_index=0)
| Generates the joint histogram for a given raster/band pair.
double | getSum (unsigned int raster_index, unsigned int pol_index=0)
| Sum of all pixels values.
double | getSum3 (unsigned int raster_index, unsigned int pol_index=0)
| The cubic sum of pixels values.
double | getSum4 (unsigned int raster_index, unsigned int pol_index=0)
| The quartic sum of pixels values.
double | getMean (unsigned int raster_index, unsigned int pol_index=0)
| Mean pixels value for input_image1.
double | getCovariance (unsigned int raster1_index, unsigned int raster2_index, unsigned int pol_index=0)
| Covariance between two bands.
double | getVariance (unsigned int raster_index, unsigned int pol_index=0)
| Variance of one band data.
double | getStdDev (unsigned int raster_index, unsigned int pol_index=0)
| Standard deviation of one band data.
double | getEntropy (unsigned int raster_index, unsigned int pol_index=0)
| Entropy of one band data.
double | getMin (unsigned int raster_index, unsigned int pol_index=0)
| The minimum pixel value of one band data.
double | getMax (unsigned int raster_index, unsigned int pol_index=0)
| The maximum pixel value of one band data.
double | getMode (unsigned int raster_index, unsigned int pol_index=0)
| The highest frequency pixel value of one band data (mode).
double | getCorrelation (unsigned int raster1_index, unsigned int raster2_index, unsigned int pol_index=0)
| Correlation between two bands.
double | getPercentile (double sample_index, unsigned int raster_index, unsigned int pol_index=0)
| The Percentile value of one band data.
TeMatrix | getMeanMatrix (unsigned int pol_index=0)
| Mean matrix calcule.
TeMatrix | getCMMatrix (unsigned int pol_index=0)
| Central moments matrix.
TeMatrix | getAssimetryMatrix (unsigned int pol_index=0)
| Assimetry coefficients matrix.
TeMatrix | getKurtosisMatrix (unsigned int pol_index=0)
| Kurtosis coefficients matrix.
TeMatrix | getVarCoefMatrix (unsigned int pol_index=0)
| Variation coefficients matrix.
TeMatrix | getCovMatrix (unsigned int pol_index=0)
| Covariance matrix.
TeMatrix | getCorMatrix (unsigned int pol_index=0)
| Correlation matrix.
TeMatrix | getVarMatrix (unsigned int pol_index=0)
| Variance matrix.
TeMatrix | getStdDevMatrix (unsigned int pol_index=0)
| Standard deviation matrix.

## Protected Types

typedef std::pair< unsigned int, unsigned int > | SingleRasterCachesKeyT
typedef std::pair< unsigned int, SingleRasterCachesKeyT > | CoupleRasterCachesKeyT
typedef std::map < SingleRasterCachesKeyT, TePDIHistogram * > | HistoCacheT
typedef std::map < CoupleRasterCachesKeyT, TePDIJointHistogram * > | JHistoCacheT

## Protected Member Functions

bool | RunImplementation ()
| Runs the current algorithm implementation.
void | ResetState (const TePDIParameters &params)
| Reset the internal state to the initial state.
double | getSumPB1B2 (unsigned int raster1_index, unsigned int raster2_index, unsigned int pol_index)
| Sum of products between all pixels from different bands.
void | clear ()
| Clears all internal allocated structures.

## Protected Attributes

TePDITypes::TePDIPolygonSetPtrType | polygonset_
| The current restriction polygon set.
TePDITypes::TePDIRasterVectorType | rasters_
| The current rasters.
std::vector< int > | bands_
| The current rasters bands.
JHistoCacheT | jHistoCache_
| Joint histograms cache.
HistoCacheT | histo_cache_
| A cache of level ordered histograms to avoid rebuilding histograms all the times.
TeStrategicIterator | iterator_strat_
| The current iterator strategy.

## Detailed Description

This is the class for statistic calcules over raster data.

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

Note:
  The general required parameters are:

Parameters:

  rasters | ( TePDITypes::TePDIRasterVectorType ) - A vector of all used rasters ( NOTE: When more then one band is used from the same raster, this raster must appear more then one time ).
  bands | ( std::vector< int > ) - A vector of all used bands for each raster inside the reasters vector above respectively.

Note:
  The following parameters are optional, and will be used if present.

Parameters:

  polygonset | ( TePDITypes::TePDIPolygonSetPtrType ) - Restriction polygon set - The area where to do calcules over all rasters - If not present the entire raster area will be used.
  histograms | ( std::vector< TePDIHistogram::pointer > ) - A vector of all raster histogram references ( internal histogram generation will be disabled - This parameter cannot be used when the parameter polygonset is present );
  iterator_strat | ( TeStrategicIterator ) - The iteration strategy used when analysing the raster elements ( default value: TeBoxPixelIn - Only pixels with center inside the polygonset will be considered ).

Note:
  For the methods using two or more channels(bands): No spatial overlay is checked. Images with the same number of lines and columns are required.

Examples:

  TePDIStatistic_test.cpp.

## Member Typedef Documentation

const TeSharedPtr< TePDIStatistic > TePDIStatistic::const_pointer

Type definition for a const instance pointer

Reimplemented from TePDIAlgorithm.

std::pair< unsigned int, SingleRasterCachesKeyT > TePDIStatistic::CoupleRasterCachesKeyT`[protected]`

A type definition for a cache related to a couple of rasters.

Parameters:

  unsigned int | Raster1 index.
  SingleRasterCachesKeyT | Raster2 index / polygon index.

typedef std::map< SingleRasterCachesKeyT, TePDIHistogram* > TePDIStatistic::HistoCacheT`[protected]`

Histogram cache type definition

typedef std::map< CoupleRasterCachesKeyT, TePDIJointHistogram* > TePDIStatistic::JHistoCacheT`[protected]`

Joint histogram cache type definition

TeSharedPtr< TePDIStatistic > TePDIStatistic::pointer

Type definition for a instance pointer

Reimplemented from TePDIAlgorithm.

std::pair< unsigned int, unsigned int > TePDIStatistic::SingleRasterCachesKeyT`[protected]`

A type definition for a cache related to a single raster.

Parameters:

  unsigned int | Raster index.
  unsigned int | Polygon index.

## Constructor & Destructor Documentation

TePDIStatistic::TePDIStatistic | ( |  | ) |

Default Constructor.

TePDIStatistic::~TePDIStatistic | ( |  | ) |

Default Destructor.

## Member Function Documentation

bool TePDIStatistic::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.

void TePDIStatistic::clear | ( |  | ) | `[protected]`

Clears all internal allocated structures.

TeMatrix TePDIStatistic::getAssimetryMatrix | ( | unsigned int | pol_index = `0` | ) |

Assimetry coefficients matrix.

Note:
  Lines = 1, Columns = total bands/rasters number.

Parameters:

  pol_index | The polygon index inside the polygon set ( if no polygon set is present, use de default zero value ).

Returns:
  The Assimetry coefficients matrix.

Note:
  Those matrix elements where an error ocurred are marked with value DBL_MAX;

Examples:
  TePDIStatistic_test.cpp.

TeMatrix TePDIStatistic::getCMMatrix | ( | unsigned int | pol_index = `0` | ) |

Central moments matrix.

Note:
  Lines = 3, Columns = total bands/rasters number.

Parameters:

  raster_index | Index for the used raster / band ( using the supplied parameters )
  pol_index | The polygon index inside the polygon set ( if no polygon set is present, use de default zero value ).

Returns:
  The central moments matrix.

Note:
  Those matrix elements where an error ocurred are marked with value DBL_MAX;

Examples:
  TePDIStatistic_test.cpp.

TeMatrix TePDIStatistic::getCorMatrix | ( | unsigned int | pol_index = `0` | ) |

Correlation matrix.

Note:
  Lines = total bands/rasters number, Columns = total bands/rasters number.

Parameters:

  pol_index | The polygon index inside the polygon set ( if no polygon set is present, use de default zero value ).*

Returns:
  The Correlation matrix.

Note:
  Those matrix elements where an error ocurred are marked with value DBL_MAX;

Examples:
  TePDIStatistic_test.cpp.

double TePDIStatistic::getCorrelation | ( | unsigned int | raster1_index,
|  | unsigned int | raster2_index,
|  | unsigned int | pol_index = `0`
| ) |  |

Correlation between two bands.

Parameters:

  raster1_index | Index for the first used raster / band ( using the supplied parameters )
  raster2_index | Index for the second used raster / band ( using the supplied parameters )
  pol_index | The polygon index inside the polygon set ( if no polygon set is present, use de default zero value ).

Returns:
  The correlation value or DBL_MAX when an error occurs.

Examples:
  TePDIStatistic_test.cpp.

double TePDIStatistic::getCovariance | ( | unsigned int | raster1_index,
|  | unsigned int | raster2_index,
|  | unsigned int | pol_index = `0`
| ) |  |

Covariance between two bands.

Parameters:

  raster1_index | Index for the first used raster / band ( using the supplied parameters )
  raster2_index | Index for the second used raster / band ( using the supplied parameters )
  pol_index | The polygon index inside the polygon set ( if no polygon set is present, use de default zero value ).

Returns:
  The covariance value or DBL_MAX when an error occurs.

Examples:
  TePDIStatistic_test.cpp.

TeMatrix TePDIStatistic::getCovMatrix | ( | unsigned int | pol_index = `0` | ) |

Covariance matrix.

Note:
  Lines = total bands/rasters number, Columns = total bands/rasters number.

Parameters:

  pol_index | The polygon index inside the polygon set ( if no polygon set is present, use de default zero value ).*

Returns:
  The Covariance matrix.

Note:
  Those matrix elements where an error ocurred are marked with value DBL_MAX;

Examples:
  TePDIStatistic_test.cpp.

double TePDIStatistic::getEntropy | ( | unsigned int | raster_index,
|  | unsigned int | pol_index = `0`
| ) |  |

Entropy of one band data.

Parameters:

  raster_index | Index for the used raster / band ( using the supplied parameters )
  pol_index | The polygon index inside the polygon set ( if no polygon set is present, use de default zero value ).

Returns:
  The entropy value or DBL_MAX when an error occurs.

Examples:
  TePDIStatistic_test.cpp.

const TePDIHistogram & TePDIStatistic::getHistogram | ( | unsigned int | raster_index,
|  | unsigned int | pol_index = `0`
| ) |  |

Generates the histogram for a given raster/band.

Note:
  The internal histogram generation will use 256 levels for interpolated histograms when generated from floating point data type rasters.

Parameters:

  raster_index | Index for the raster ( using the supplied parameters ).
  pol_index | The polygon index inside the polygon set ( if no polygon set is present, use de default zero value ).

Returns:
  The histogram pointer.

Examples:
  TePDIStatistic_test.cpp.

const TePDIJointHistogram & TePDIStatistic::getJointHistogram | ( | unsigned int | raster1_index,
|  | unsigned int | raster2_index,
|  | unsigned int | pol_index = `0`
| ) |  |

Generates the joint histogram for a given raster/band pair.

Parameters:

  raster1_index | Index for the first raster.
  raster2_index | Index for the second raster.
  pol_index | The polygon index inside the polygon set ( if no polygon set is present, use de default zero value ).

Returns:
  The histogram reference.

TeMatrix TePDIStatistic::getKurtosisMatrix | ( | unsigned int | pol_index = `0` | ) |

Kurtosis coefficients matrix.

Note:
  Lines = 1, Columns = total bands/rasters number.

Parameters:

  pol_index | The polygon index inside the polygon set ( if no polygon set is present, use de default zero value ).

Returns:
  The Kurtosis coefficients matrix.

Note:
  Those matrix elements where an error ocurred are marked with value DBL_MAX;

Examples:
  TePDIStatistic_test.cpp.

double TePDIStatistic::getMax | ( | unsigned int | raster_index,
|  | unsigned int | pol_index = `0`
| ) |  |

The maximum pixel value of one band data.

Parameters:

  raster_index | Index for the used raster / band ( using the supplied parameters )
  pol_index | The polygon index inside the polygon set ( if no polygon set is present, use de default zero value ).

Returns:
  The maximum pixel value value or DBL_MAX when an error occurs.

Examples:
  TePDIStatistic_test.cpp.

double TePDIStatistic::getMean | ( | unsigned int | raster_index,
|  | unsigned int | pol_index = `0`
| ) |  |

Mean pixels value for input_image1.

Parameters:

  raster_index | Index for the raster ( using the supplied parameters )
  pol_index | The polygon index inside the polygon set ( if no polygon set is present, use de default zero value ).

Returns:
  The mean value or DBL_MAX when an error occurs.

Examples:
  TePDIStatistic_test.cpp.

TeMatrix TePDIStatistic::getMeanMatrix | ( | unsigned int | pol_index = `0` | ) |

Mean matrix calcule.

Note:
  Lines = 1, Columns = total bands/rasters number.

Parameters:

  raster_index | Index for the used raster / band ( using the supplied parameters )
  pol_index | The polygon index inside the polygon set ( if no polygon set is present, use de default zero value ).

Returns:
  The mean matrix.

Note:
  Those matrix elements where an error ocurred are marked with value DBL_MAX;

double TePDIStatistic::getMin | ( | unsigned int | raster_index,
|  | unsigned int | pol_index = `0`
| ) |  |

The minimum pixel value of one band data.

Parameters:

  raster_index | Index for the used raster / band ( using the supplied parameters )
  pol_index | The polygon index inside the polygon set ( if no polygon set is present, use de default zero value ).

Returns:
  The minimum pixel value value or DBL_MAX when an error occurs.

Examples:
  TePDIStatistic_test.cpp.

double TePDIStatistic::getMode | ( | unsigned int | raster_index,
|  | unsigned int | pol_index = `0`
| ) |  |

The highest frequency pixel value of one band data (mode).

Parameters:

  raster_index | Index for the used raster / band ( using the supplied parameters )
  pol_index | The polygon index inside the polygon set ( if no polygon set is present, use de default zero value ).

Returns:
  The highest frequency pixel value of one band data (mode) or DBL_MAX when an error occurs.

Examples:
  TePDIStatistic_test.cpp.

double TePDIStatistic::getPercentile | ( | double | sample_index,
|  | unsigned int | raster_index,
|  | unsigned int | pol_index = `0`
| ) |  |

The Percentile value of one band data.

Parameters:

  sample_index | Sample index ( 0 -> 100 );
  raster_index | Index for the used raster / band ( using the supplied parameters )
  pol_index | The polygon index inside the polygon set ( if no polygon set is present, use de default zero value ).

Returns:
  The highest frequency pixel value of one band data (mode) or DBL_MAX when an error occurs.

Examples:
  TePDIStatistic_test.cpp.

double TePDIStatistic::getStdDev | ( | unsigned int | raster_index,
|  | unsigned int | pol_index = `0`
| ) |  |

Standard deviation of one band data.

Parameters:

  raster_index | Index for the used raster / band ( using the supplied parameters )
  pol_index | The polygon index inside the polygon set ( if no polygon set is present, use de default zero value ).

Returns:
  The Standard deviation value or DBL_MAX when an error occurs.

Examples:
  TePDIStatistic_test.cpp.

TeMatrix TePDIStatistic::getStdDevMatrix | ( | unsigned int | pol_index = `0` | ) |

Standard deviation matrix.

Note:
  Lines = total bands/rasters number, Columns = 1.

Parameters:

  pol_index | The polygon index inside the polygon set ( if no polygon set is present, use de default zero value ).*

Returns:
  The Standard deviation matrix.

Note:
  Those matrix elements where an error ocurred are marked with value DBL_MAX;

Examples:
  TePDIStatistic_test.cpp.

double TePDIStatistic::getSum | ( | unsigned int | raster_index,
|  | unsigned int | pol_index = `0`
| ) |  |

Sum of all pixels values.

Parameters:

  raster_index | Index for the raster ( using the supplied parameters )
  pol_index | The polygon index inside the polygon set ( if no polygon set is present, use de default zero value ).

Returns:
  The sum value or DBL_MAX when an error occurs.

Examples:
  TePDIStatistic_test.cpp.

double TePDIStatistic::getSum3 | ( | unsigned int | raster_index,
|  | unsigned int | pol_index = `0`
| ) |  |

The cubic sum of pixels values.

Parameters:

  raster_index | Index for the used raster / band ( using the supplied parameters ).
  pol_index | The polygon index inside the polygon set ( if no polygon set is present, use de default zero value ).

Returns:
  The pixel level sum or DBL_MAX when an error occurs.

Examples:
  TePDIStatistic_test.cpp.

double TePDIStatistic::getSum4 | ( | unsigned int | raster_index,
|  | unsigned int | pol_index = `0`
| ) |  |

The quartic sum of pixels values.

Parameters:

  raster_index | Index for the used raster / band ( using the supplied parameters ).
  pol_index | The polygon index inside the polygon set ( if no polygon set is present, use de default zero value ).

Returns:
  The pixel level sum or DBL_MAX when an error occurs.

Examples:
  TePDIStatistic_test.cpp.

double TePDIStatistic::getSumPB1B2 | ( | unsigned int | raster1_index,
|  | unsigned int | raster2_index,
|  | unsigned int | pol_index
| ) |  | `[protected]`

Sum of products between all pixels from different bands.

Parameters:

  raster1_index | Index for the first used raster / band ( using the supplied parameters ).
  raster2_index | Index for the second used raster / band ( using the supplied parameters ).
  pol_index | The polygon index inside the polygon set ( if no polygon set is present, use de default zero value ).

Returns:
  The Sum of products or DBL_MAX when an error occurs.

TeMatrix TePDIStatistic::getVarCoefMatrix | ( | unsigned int | pol_index = `0` | ) |

Variation coefficients matrix.

Note:
  Lines = 1, Columns = total bands/rasters number.

Parameters:

  pol_index | The polygon index inside the polygon set ( if no polygon set is present, use de default zero value ).*

Returns:
  The Variation coefficients matrix.

Note:
  Those matrix elements where an error ocurred are marked with value DBL_MAX;

Examples:
  TePDIStatistic_test.cpp.

double TePDIStatistic::getVariance | ( | unsigned int | raster_index,
|  | unsigned int | pol_index = `0`
| ) |  |

Variance of one band data.

Parameters:

  raster_index | Index for the used raster / band ( using the supplied parameters )
  pol_index | The polygon index inside the polygon set ( if no polygon set is present, use de default zero value ).

Returns:
  The variance value or DBL_MAX when an error occurs.

Examples:
  TePDIStatistic_test.cpp.

TeMatrix TePDIStatistic::getVarMatrix | ( | unsigned int | pol_index = `0` | ) |

Variance matrix.

Note:
  Lines = total bands/rasters number, Columns = 1.

Parameters:

  pol_index | The polygon index inside the polygon set ( if no polygon set is present, use de default zero value ).*

Returns:
  The Variance matrix.

Note:
  Those matrix elements where an error ocurred are marked with value DBL_MAX;

Examples:
  TePDIStatistic_test.cpp.

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

Reset the internal state to the initial state.

params The new parameters referente at initial state.

Implements TePDIAlgorithm.

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

Runs the current algorithm implementation.

Returns:
  true if OK. false on error.

Implements TePDIAlgorithm.

## Member Data Documentation

std::vector< int > TePDIStatistic::bands_`[protected]`

The current rasters bands.

HistoCacheT TePDIStatistic::histo_cache_`[protected]`

A cache of level ordered histograms to avoid rebuilding histograms all the times.

TeStrategicIterator TePDIStatistic::iterator_strat_`[protected]`

The current iterator strategy.

JHistoCacheT TePDIStatistic::jHistoCache_`[protected]`

Joint histograms cache.

TePDITypes::TePDIPolygonSetPtrType TePDIStatistic::polygonset_`[protected]`

The current restriction polygon set.

TePDITypes::TePDIRasterVectorType TePDIStatistic::rasters_`[protected]`

The current rasters.

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

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

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines