| TerraLib 4.1

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

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

Public Member Functions | Protected Member Functions | Protected Attributes
TePDIMallatWavelets Class Reference
Wavelets algorithms.

Mallat wavelts algorithm. More...

`#include <TePDIMallatWavelets.hpp>`

Inheritance diagram for TePDIMallatWavelets:

List of all members.

## Public Member Functions

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

## Protected Member Functions

bool | RunImplementation ()
| Runs the current algorithm implementation.
void | ResetState (const TePDIParameters &params)
| Reset the internal state to the initial state.
bool | Decompose (const TePDIParameters &params)
| Do Wavelet decomposition using input_image and levels number parameters.
bool | Recompose (unsigned int ref_level, const TePDIParameters &params)
| Do Wavelet recomposition to output_image parameter and the current internal state.
bool | GetSubBand (unsigned int level, unsigned int subband, const TePDITypes::TePDIRasterPtrType &sb_raster) const
| Returns a copy of one genereted sub-band.
bool | ChangeSubBand (unsigned int level, unsigned int subband_index, const TePDITypes::TePDIRasterPtrType &newsband)
| Change one genereted sub-band by another one.
bool | PushLevel (unsigned int level, const TePDIMatrix< double > &sb0, const TePDIMatrix< double > &sb1, const TePDIMatrix< double > &sb2, const TePDIMatrix< double > &sb3)
| Push a new level at pyramid level's top.
bool | GetAnalysisFilters (std::vector< double > &low_filter, std::vector< double > &high_filter, int &low_shift, int &high_shift, const TePDIParameters &params) const
| Retrive the analysis filters from the internal parameters.
bool | GetSynthesisFilters (std::vector< double > &low_filter, std::vector< double > &high_filter, int &low_shift, int &high_shift, const TePDIParameters &params) const
| Retrive the synthesis filters from the internal parameters.
bool | GenerateLevel (unsigned int level, const TePDIParameters &params)
| Generates one level of Wavelet decomposition, using the data from the preceding level.
void | ApplyVerticalFilter (const TePDIMatrix< double > &inMatrix, const std::vector< double > &filter, int filter_shift, TePDIMatrix< double > &outMatrix) const
| Applies a vertical filter.
void | ApplyHorizontalFilter (const TePDIMatrix< double > &inMatrix, const std::vector< double > &filter, int filter_shift, TePDIMatrix< double > &outMatrix) const
| Applies a horizontal filter.
bool | BuildSuperimposedLevel (unsigned int level, TePDIMatrix< double > &level_matrix, bool normalize=false, double min_norm_level=0, double max_norm_level=0) const
| Recursive build of a simperimposed level ( a level where the sub-band 0 is a composition of all higher levels ).
bool | AgregateSubBands (const TePDIMatrix< double > &upper_left, const TePDIMatrix< double > &upper_right, const TePDIMatrix< double > &lower_left, const TePDIMatrix< double > &lower_right, TePDIMatrix< double > &result) const
| Build a agregated matrix using 4 sub-bands of identical dimensions.
bool | AllocateTopLevel (unsigned int level, unsigned int sblines=0, unsigned int sbcolumns=0)
| Allocate space for a new level at pyrimid's top.
bool | GetAFiltersShift (const std::vector< double > &a_lowfilter, const std::vector< double > &a_highfilter, int &lowshift, int &highshift) const
| Compute the analysis inversed filters reference shift ( offset ).
bool | GetSFiltersShift (const std::vector< double > &a_lowfilter, const std::vector< double > &a_highfilter, const std::vector< double > &s_lowfilter, const std::vector< double > &s_highfilter, int &lowshift, int &highshift) const
| Compute the syntesis inversed filters reference shift ( offset ).
bool | ReconstructLL (const TePDIMatrix< double > &sb00_in, const TePDIMatrix< double > &sb01_in, const TePDIMatrix< double > &sb10_in, const TePDIMatrix< double > &sb11_in, const std::vector< double > &s_low_filter, const std::vector< double > &s_high_filter, int lowshift, int highshift, TePDIMatrix< double > &sb00_out) const
| Reconstruct the Low-low ( 0, 0 ) sub-band.
bool | UpSampleMatrix (const TePDIMatrix< double > &in, TePDIMatrix< double > &out) const
| Up-samples a matrix.
bool | AddMatrixes (const TePDIMatrix< double > &in1, const TePDIMatrix< double > &in2, TePDIMatrix< double > &res) const
| Matrix addition.
bool | ApplyVerticalRFilter (const TePDIMatrix< double > &inMatrix, const std::vector< double > &filter, int filter_shift, TePDIMatrix< double > &outMatrix) const
| Applies a reconstruction vertical filter.
bool | ApplyHorizontalRFilter (const TePDIMatrix< double > &inMatrix, const std::vector< double > &filter, int filter_shift, TePDIMatrix< double > &outMatrix) const
| Applies a reconstruction horizontal filter.
bool | NormalizeMatrix (const TePDIMatrix< double > &input, TePDIMatrix< double > &output, double min, double max) const
| Do matrix normalization using the supplied ranges.

## Protected Attributes

bool | shift_histogram_flag_
| Histogram shift flag.
double | input_image_mean_
| The input image mean ( used for histogram shift ).
std::vector< TePDIMatrix < TePDIMatrix< double > > > | pyramid_
| Internal pyramidal structure of decomposed bands.

## Detailed Description

Mallat wavelts algorithm.

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

Note:
  The general required parameters:

Parameters:

  filter_task | ( std::string ) - Task to be accomplished - see below.
  filters_scale | ( double ) - The filters scale.
  a_filter_l | ( std::vector< double > ) - Analysis filter, low pass, non normalized ( used in decomposition ).
  a_filter_h | ( std::vector< double > ) - Analysis filter, high pass, non normalized ( used in decomposition ).
  s_filter_l | ( std::vector< double > ) - Synthesis filter, low pass, non normalized ( used in recomposition ).
  s_filter_h | ( std::vector< double > ) - Synthesis filter, high pass, non normalized ( used in recomposition ).

Note:
  The input parameters for filter_task="SBExtract" are:

Parameters:

  input_image | ( TePDITypes::TePDIRasterPtrType ) - Input Image.
  band | ( int ) - Input band from input_image.
  sub_band | ( TePDITypes::TePDIRasterPtrType ) - The extracted sub-band raster reference.
  sub_band_index | ( int ) - Sub-band index [ 0, 1, 2, 3 ].
  levels | ( int ) - The number of decomposition levels.

Note:
  The input parameters for filter_task="SBSwap" are:

Parameters:

  input_image | ( TePDITypes::TePDIRasterPtrType ) - Input Image.
  band | ( int ) - Input band from input_image.
  output_image | ( TePDITypes::TePDIRasterPtrType ) - Output Image.
  sub_band | ( TePDITypes::TePDIRasterPtrType ) - The new sub-band raster reference.
  sub_band_index | ( int ) - Sub-band index [ 0, 1, 2, 3 ].
  levels | ( int ) - The number of decomposition levels.

Note:
  The input parameters for filter_task="GetPyramid" are:

Parameters:

  input_image | ( TePDITypes::TePDIRasterPtrType ) - Input Image.
  band | ( int ) - Input band from input_image.
  sub_band | ( TePDITypes::TePDIRasterPtrType ) - The extracted sub-band raster reference.
  sub_band_index | ( int ) - Sub-band index [ 0, 1, 2, 3 ].
  levels | ( int ) - The number of decomposition levels.
  pyramid | ( TePDITypes::TePDIRasterVectorPtrType ) - The generated pyramid following the format : [raster0][raster1][raster2][raster3]....[raster( levels*4 - 1 )] where: raster0->sub-band00 of level1, raster1->sub-band01 of level1, raster2->sub-band10 of level1, raster3->sub-band11 of level1, raster4->sub-band00 of level2, ....., raster(n-1)->sub-band11 of the last level.

Note:
  The input parameters for filter_task="RecomposePyramid" are:

Parameters:

  input_image | ( TePDITypes::TePDIRasterPtrType - Optional ): Reference Input Image.
  band | ( int - Optional ) - Input band from input_image.
  pyramid | ( TePDITypes::TePDIRasterVectorPtrType ) - The input pyramid following the format: [raster0][raster1][raster2][raster3]....[raster( levels*4 - 1 )] where: raster0->sub-band00 of level1, raster1->sub-band01 of level1, raster2->sub-band10 of level1, raster3->sub-band11 of level1, raster4->sub-band00 of level2, ....., raster(n-1)->sub-band11 of the last level.
  output_image | ( TePDITypes::TePDIRasterPtrType ) - Output Image.

Note:
  Each decomposed level will follow the structure ( matricial indexes ): index 0 = [ 0, 0 ] = Low-Low filtered - upper-left . index 1 = [ 0, 1 ] = Low-High filtered - upper-right. index 2 = [ 1, 0 ] = High-Low filtered - bottom-left. index 3 = [ 1, 1 ] = High-High filtered - bottom-right.

Examples:

  TePDIWavelets_test.cpp.

## Constructor & Destructor Documentation

TePDIMallatWavelets::TePDIMallatWavelets | ( |  | ) |

Default Constructor.

TePDIMallatWavelets::~TePDIMallatWavelets | ( |  | ) |

Default Destructor.

## Member Function Documentation

bool TePDIMallatWavelets::AddMatrixes | ( | const TePDIMatrix< double > & | in1,
|  | const TePDIMatrix< double > & | in2,
|  | TePDIMatrix< double > & | res
| ) |  | const`[protected]`

Matrix addition.

Parameters:

  in1 | Input matrix 1.
  in2 | Input matrix 2.
  res | Result matrix.

Returns:
  true if ok, false on errors.

bool TePDIMallatWavelets::AgregateSubBands | ( | const TePDIMatrix< double > & | upper_left,
|  | const TePDIMatrix< double > & | upper_right,
|  | const TePDIMatrix< double > & | lower_left,
|  | const TePDIMatrix< double > & | lower_right,
|  | TePDIMatrix< double > & | result
| ) |  | const`[protected]`

Build a agregated matrix using 4 sub-bands of identical dimensions.

Parameters:

  upper_left | Uppper-left sub-band.
  upper_right | Uppper-right sub-band.
  lower_left | Lower-left sub-band.
  lower_right | Lower-right sub-band.
  result | The user pre-initiated result matrix where all data will be stored.

Returns:
  true if ok, false on error.

bool TePDIMallatWavelets::AllocateTopLevel | ( | unsigned int | level,
|  | unsigned int | sblines = `0`,
|  | unsigned int | sbcolumns = `0`
| ) |  | `[protected]`

Allocate space for a new level at pyrimid's top.

Parameters:

  level | Level number.
  sblines | Sub-bands lines number ( only required if level == 1 ).
  sbcolumns | Sub-bands columns number ( only required if level == 1 ).

Returns:
  true if ok, false on error.

void TePDIMallatWavelets::ApplyHorizontalFilter | ( | const TePDIMatrix< double > & | inMatrix,
|  | const std::vector< double > & | filter,
|  | int | filter_shift,
|  | TePDIMatrix< double > & | outMatrix
| ) |  | const`[protected]`

Applies a horizontal filter.

Parameters:

  inMatrix | Input matrix.
  filter | Filter to apply.
  filter_shift | Filter shift.
  outMatrix | Output matrix.

bool TePDIMallatWavelets::ApplyHorizontalRFilter | ( | const TePDIMatrix< double > & | inMatrix,
|  | const std::vector< double > & | filter,
|  | int | filter_shift,
|  | TePDIMatrix< double > & | outMatrix
| ) |  | const`[protected]`

Applies a reconstruction horizontal filter.

Parameters:

  inMatrix | An upsampled Input matrix.
  filter | Filter to apply.
  filter_shift | Filter shift.
  outMatrix | Output matrix.

Returns:
  true if ok, false on errors.

void TePDIMallatWavelets::ApplyVerticalFilter | ( | const TePDIMatrix< double > & | inMatrix,
|  | const std::vector< double > & | filter,
|  | int | filter_shift,
|  | TePDIMatrix< double > & | outMatrix
| ) |  | const`[protected]`

Applies a vertical filter.

Parameters:

  inMatrix | Input matrix.
  filter | Filter to apply.
  filter_shift | Filter shift.
  outMatrix | Output matrix.

bool TePDIMallatWavelets::ApplyVerticalRFilter | ( | const TePDIMatrix< double > & | inMatrix,
|  | const std::vector< double > & | filter,
|  | int | filter_shift,
|  | TePDIMatrix< double > & | outMatrix
| ) |  | const`[protected]`

Applies a reconstruction vertical filter.

Parameters:

  inMatrix | A Input matrix filtered with ApplyHorizontalRFilter.
  filter | Filter to apply.
  filter_shift | Filter shift.
  outMatrix | Output matrix.

Returns:
  true if ok, false on errors.

bool TePDIMallatWavelets::BuildSuperimposedLevel | ( | unsigned int | level,
|  | TePDIMatrix< double > & | level_matrix,
|  | bool | normalize = `false`,
|  | double | min_norm_level = `0`,
|  | double | max_norm_level = `0`
| ) |  | const`[protected]`

Recursive build of a simperimposed level ( a level where the sub-band 0 is a composition of all higher levels ).

Parameters:

  level | Decomposition level ( starting from 1 ).
  level_matrix | The user pre-initiated resultant level matrix.
  normalize | If true, grayscale level normalization will be performed.
  min_norm_level | Minimal grayscale level used for grayscale range normalization.
  max_norm_level | Maximum grayscale level used for grayscale range normalization.

Returns:
  true if ok, false on error.

bool TePDIMallatWavelets::ChangeSubBand | ( | unsigned int | level,
|  | unsigned int | subband_index,
|  | const TePDITypes::TePDIRasterPtrType & | newsband
| ) |  | `[protected]`

Change one genereted sub-band by another one.

Note:
  Both sub-bands must have the same number of lines and columns.

Parameters:

  level | Sub-band decomposition level ( starting from 1 ).
  subband_index | Old Sub-band index [ 0 - top left, 1 - top right, 2 - bottom left, 3 - bottom right ].
  newsband | The new sub-band data.

Returns:
  true if ok, false on errors.

bool TePDIMallatWavelets::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 TePDIMallatWavelets::Decompose | ( | const TePDIParameters & | params | ) | `[protected]`

Do Wavelet decomposition using input_image and levels number parameters.

Note:
  No output image will be generated by this function. To decompose and generate output image use Apply() ( using Apply() the generated image will be saved inside the output_image parameter );

Parameters:

  params | The current strategy parameters reference.

Returns:
  true if no erros ocurred.

bool TePDIMallatWavelets::GenerateLevel | ( | unsigned int | level,
|  | const TePDIParameters & | params
| ) |  | `[protected]`

Generates one level of Wavelet decomposition, using the data from the preceding level.

Parameters:

  level | Decomposition level ( starting from 1 ).
  params | The current strategy parameters reference.

Returns:
  true if ok, false on errors.

bool TePDIMallatWavelets::GetAFiltersShift | ( | const std::vector< double > & | a_lowfilter,
|  | const std::vector< double > & | a_highfilter,
|  | int & | lowshift,
|  | int & | highshift
| ) |  | const`[protected]`

Compute the analysis inversed filters reference shift ( offset ).

Parameters:

  a_lowfilter | The analysis low filter reference.
  a_highfilter | The analysis high filter reference.
  lowshift | The computed shift for lowfilter.
  highshift | The computed shift for highfilter.

Returns:
  true if ok, false on errors.

bool TePDIMallatWavelets::GetAnalysisFilters | ( | std::vector< double > & | low_filter,
|  | std::vector< double > & | high_filter,
|  | int & | low_shift,
|  | int & | high_shift,
|  | const TePDIParameters & | params
| ) |  | const`[protected]`

Retrive the analysis filters from the internal parameters.

Parameters:

  low_filter | The low filter.
  high_filter | The high filter.
  low_shift | The low filter shift.
  high_shift | The high filter shift.
  params | The current strategy parameters reference.

Returns:
  true if ok, false on errors.

bool TePDIMallatWavelets::GetSFiltersShift | ( | const std::vector< double > & | a_lowfilter,
|  | const std::vector< double > & | a_highfilter,
|  | const std::vector< double > & | s_lowfilter,
|  | const std::vector< double > & | s_highfilter,
|  | int & | lowshift,
|  | int & | highshift
| ) |  | const`[protected]`

Compute the syntesis inversed filters reference shift ( offset ).

Parameters:

  s_lowfilter | The syntesis low filter reference.
  s_highfilter | The syntesis high filter reference.
  a_lowfilter | The analysis low filter reference.
  a_highfilter | The analysis high filter reference.
  lowshift | The computed shift for lowfilter.
  highshift | The computed shift for highfilter.

Returns:
  true if ok, false on errors.

bool TePDIMallatWavelets::GetSubBand | ( | unsigned int | level,
|  | unsigned int | subband,
|  | const TePDITypes::TePDIRasterPtrType & | sb_raster
| ) |  | const`[protected]`

Returns a copy of one genereted sub-band.

Parameters:

  level | Sub-band decomposition level ( starting from 1 ).
  subband | Sub-band index [ 0 - top left, 1 - top right, 2 - bottom left, 3 - bottom right ].
  sb_raster | The raster where the sub-band data will be copied.

Returns:
  true if ok, false on errors.

bool TePDIMallatWavelets::GetSynthesisFilters | ( | std::vector< double > & | low_filter,
|  | std::vector< double > & | high_filter,
|  | int & | low_shift,
|  | int & | high_shift,
|  | const TePDIParameters & | params
| ) |  | const`[protected]`

Retrive the synthesis filters from the internal parameters.

Parameters:

  low_filter | The low filter.
  high_filter | The high filter.
  low_shift | The low filter shift.
  high_shift | The high filter shift.
  params | The current strategy parameters reference.

Returns:
  true if ok, false on errors.

bool TePDIMallatWavelets::NormalizeMatrix | ( | const TePDIMatrix< double > & | input,
|  | TePDIMatrix< double > & | output,
|  | double | min,
|  | double | max
| ) |  | const`[protected]`

Do matrix normalization using the supplied ranges.

Parameters:

  input | The input matrix.
  output | The output matrix.
  min | The mininum reference value.
  max | The maxumum reference value.

bool TePDIMallatWavelets::PushLevel | ( | unsigned int | level,
|  | const TePDIMatrix< double > & | sb0,
|  | const TePDIMatrix< double > & | sb1,
|  | const TePDIMatrix< double > & | sb2,
|  | const TePDIMatrix< double > & | sb3
| ) |  | `[protected]`

Push a new level at pyramid level's top.

Parameters:

  level | Sub-band level ( starting from 1 ).
  sb0 | Sub-band 0 ( top left ) data.
  sb1 | Sub-band 1 ( top right ) data.
  sb2 | Sub-band 2 ( bottom left ) data.
  sb3 | Sub-band 3 ( bottom right ) data.

Returns:
  true if ok, false on errors.

bool TePDIMallatWavelets::Recompose | ( | unsigned int | ref_level,
|  | const TePDIParameters & | params
| ) |  | `[protected]`

Do Wavelet recomposition to output_image parameter and the current internal state.

Note:
  If a input_image exists, it will be used to guess the recomposed image dimensions.

Parameters:

  ref_level | The reference level used for image reconstruction ( starting from 1 ), this level will be used to reconstruct the first LL sub-band used by the other levels.
  params | The current strategy parameters reference.

Returns:
  true if no erros ocurred.

bool TePDIMallatWavelets::ReconstructLL | ( | const TePDIMatrix< double > & | sb00_in,
|  | const TePDIMatrix< double > & | sb01_in,
|  | const TePDIMatrix< double > & | sb10_in,
|  | const TePDIMatrix< double > & | sb11_in,
|  | const std::vector< double > & | s_low_filter,
|  | const std::vector< double > & | s_high_filter,
|  | int | lowshift,
|  | int | highshift,
|  | TePDIMatrix< double > & | sb00_out
| ) |  | const`[protected]`

Reconstruct the Low-low ( 0, 0 ) sub-band.

Parameters:

  sb00_in | A reference to the input sub-band ( 0, 0 ).
  sb01_in | A reference to the input sub-band ( 0, 1 ).
  sb10_in | A reference to the input sub-band ( 1, 0 ).
  sb11_in | A reference to the input sub-band ( 1, 1 ).
  s_low_filter | Low Synthesis filter.
  s_high_filter | High Synthesis filter.
  lowshift | Low filter shift.
  highshift | High filter shift.
  sb00_out | A reference to the generated sub-band ( user initiated matrix ).

Returns:
  true if ok, false on errors.

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

Runs the current algorithm implementation.

Returns:
  true if OK. false on error.

Implements TePDIAlgorithm.

bool TePDIMallatWavelets::UpSampleMatrix | ( | const TePDIMatrix< double > & | in,
|  | TePDIMatrix< double > & | out
| ) |  | const`[protected]`

Up-samples a matrix.

Parameters:

  in | Input matrix.
  out | A user initiated output matrix.

Returns:
  true if ok, false on errors.

## Member Data Documentation

double TePDIMallatWavelets::input_image_mean_`[protected]`

The input image mean ( used for histogram shift ).

std::vector< TePDIMatrix< TePDIMatrix< double > > > TePDIMallatWavelets::pyramid_`[mutable, protected]`

Internal pyramidal structure of decomposed bands.

Note:
  The index 0 corresponds to the full original input image.

bool TePDIMallatWavelets::shift_histogram_flag_`[protected]`

Histogram shift flag.

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

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

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines