pysap.base.transform#

Wavelet transform base module.

class MetaRegister(name, bases, attrs)[source]#

Bases: type

Simple Python metaclass registry pattern.

REGISTRY = {'ATrou3D': <class 'pysap.extensions.transform.ATrou3D'>, 'BiOrthogonalTransform3D': <class 'pysap.extensions.transform.BiOrthogonalTransform3D'>, 'BsplineWaveletTransformATrousAlgorithm': <class 'pysap.extensions.transform.BsplineWaveletTransformATrousAlgorithm'>, 'DecompositionOnScalingFunction': <class 'pysap.extensions.transform.DecompositionOnScalingFunction'>, 'FastCurveletTransform': <class 'pysap.extensions.transform.FastCurveletTransform'>, 'FeauveauWaveletTransform': <class 'pysap.extensions.transform.FeauveauWaveletTransform'>, 'FeauveauWaveletTransformWithoutUndersampling': <class 'pysap.extensions.transform.FeauveauWaveletTransformWithoutUndersampling'>, 'HaarWaveletTransform': <class 'pysap.extensions.transform.HaarWaveletTransform'>, 'HalfPyramidalTransform': <class 'pysap.extensions.transform.HalfPyramidalTransform'>, 'IsotropicAndCompactSupportWaveletInFourierSpace': <class 'pysap.extensions.transform.IsotropicAndCompactSupportWaveletInFourierSpace'>, 'LineColumnWaveletTransform1D1D': <class 'pysap.extensions.transform.LineColumnWaveletTransform1D1D'>, 'LinearWaveletTransformATrousAlgorithm': <class 'pysap.extensions.transform.LinearWaveletTransformATrousAlgorithm'>, 'MallatWaveletTransform79Filters': <class 'pysap.extensions.transform.MallatWaveletTransform79Filters'>, 'MeyerWaveletsCompactInFourierSpace': <class 'pysap.extensions.transform.MeyerWaveletsCompactInFourierSpace'>, 'MixedHalfPyramidalWTAndMedianMethod': <class 'pysap.extensions.transform.MixedHalfPyramidalWTAndMedianMethod'>, 'MixedWTAndPMTMethod': <class 'pysap.extensions.transform.MixedWTAndPMTMethod'>, 'MorphologicalMedianTransform': <class 'pysap.extensions.transform.MorphologicalMedianTransform'>, 'MorphologicalMinmaxTransform': <class 'pysap.extensions.transform.MorphologicalMinmaxTransform'>, 'MorphologicalPyramidalMinmaxTransform': <class 'pysap.extensions.transform.MorphologicalPyramidalMinmaxTransform'>, 'NonOrthogonalUndecimatedTransform': <class 'pysap.extensions.transform.NonOrthogonalUndecimatedTransform'>, 'OnLine44AndOnColumn53': <class 'pysap.extensions.transform.OnLine44AndOnColumn53'>, 'OnLine53AndOnColumn44': <class 'pysap.extensions.transform.OnLine53AndOnColumn44'>, 'PyramidalBsplineWaveletTransform': <class 'pysap.extensions.transform.PyramidalBsplineWaveletTransform'>, 'PyramidalLaplacian': <class 'pysap.extensions.transform.PyramidalLaplacian'>, 'PyramidalLinearWaveletTransform': <class 'pysap.extensions.transform.PyramidalLinearWaveletTransform'>, 'PyramidalMedianTransform': <class 'pysap.extensions.transform.PyramidalMedianTransform'>, 'PyramidalWaveletTransformInFourierSpaceAlgo1': <class 'pysap.extensions.transform.PyramidalWaveletTransformInFourierSpaceAlgo1'>, 'PyramidalWaveletTransformInFourierSpaceAlgo2': <class 'pysap.extensions.transform.PyramidalWaveletTransformInFourierSpaceAlgo2'>, 'UndecimatedBiOrthogonalTransform': <class 'pysap.extensions.transform.UndecimatedBiOrthogonalTransform'>, 'UndecimatedDiadicWaveletTransform': <class 'pysap.extensions.transform.UndecimatedDiadicWaveletTransform'>, 'UndecimatedHaarTransformATrousAlgorithm': <class 'pysap.extensions.transform.UndecimatedHaarTransformATrousAlgorithm'>, 'Wavelet3DTransformViaLiftingScheme': <class 'pysap.extensions.transform.Wavelet3DTransformViaLiftingScheme'>, 'WaveletTransformInFourierSpace': <class 'pysap.extensions.transform.WaveletTransformInFourierSpace'>, 'WaveletTransformViaLiftingScheme': <class 'pysap.extensions.transform.WaveletTransformViaLiftingScheme'>, 'bior11': <class 'pysap.extensions.transform.bior11'>, 'bior13': <class 'pysap.extensions.transform.bior13'>, 'bior15': <class 'pysap.extensions.transform.bior15'>, 'bior22': <class 'pysap.extensions.transform.bior22'>, 'bior24': <class 'pysap.extensions.transform.bior24'>, 'bior26': <class 'pysap.extensions.transform.bior26'>, 'bior28': <class 'pysap.extensions.transform.bior28'>, 'bior31': <class 'pysap.extensions.transform.bior31'>, 'bior33': <class 'pysap.extensions.transform.bior33'>, 'bior35': <class 'pysap.extensions.transform.bior35'>, 'bior37': <class 'pysap.extensions.transform.bior37'>, 'bior39': <class 'pysap.extensions.transform.bior39'>, 'bior44': <class 'pysap.extensions.transform.bior44'>, 'bior55': <class 'pysap.extensions.transform.bior55'>, 'bior68': <class 'pysap.extensions.transform.bior68'>, 'cgau1': <class 'pysap.extensions.transform.cgau1'>, 'cgau2': <class 'pysap.extensions.transform.cgau2'>, 'cgau3': <class 'pysap.extensions.transform.cgau3'>, 'cgau4': <class 'pysap.extensions.transform.cgau4'>, 'cgau5': <class 'pysap.extensions.transform.cgau5'>, 'cgau6': <class 'pysap.extensions.transform.cgau6'>, 'cgau7': <class 'pysap.extensions.transform.cgau7'>, 'cgau8': <class 'pysap.extensions.transform.cgau8'>, 'cmor': <class 'pysap.extensions.transform.cmor'>, 'coif1': <class 'pysap.extensions.transform.coif1'>, 'coif10': <class 'pysap.extensions.transform.coif10'>, 'coif11': <class 'pysap.extensions.transform.coif11'>, 'coif12': <class 'pysap.extensions.transform.coif12'>, 'coif13': <class 'pysap.extensions.transform.coif13'>, 'coif14': <class 'pysap.extensions.transform.coif14'>, 'coif15': <class 'pysap.extensions.transform.coif15'>, 'coif16': <class 'pysap.extensions.transform.coif16'>, 'coif17': <class 'pysap.extensions.transform.coif17'>, 'coif2': <class 'pysap.extensions.transform.coif2'>, 'coif3': <class 'pysap.extensions.transform.coif3'>, 'coif4': <class 'pysap.extensions.transform.coif4'>, 'coif5': <class 'pysap.extensions.transform.coif5'>, 'coif6': <class 'pysap.extensions.transform.coif6'>, 'coif7': <class 'pysap.extensions.transform.coif7'>, 'coif8': <class 'pysap.extensions.transform.coif8'>, 'coif9': <class 'pysap.extensions.transform.coif9'>, 'db1': <class 'pysap.extensions.transform.db1'>, 'db10': <class 'pysap.extensions.transform.db10'>, 'db11': <class 'pysap.extensions.transform.db11'>, 'db12': <class 'pysap.extensions.transform.db12'>, 'db13': <class 'pysap.extensions.transform.db13'>, 'db14': <class 'pysap.extensions.transform.db14'>, 'db15': <class 'pysap.extensions.transform.db15'>, 'db16': <class 'pysap.extensions.transform.db16'>, 'db17': <class 'pysap.extensions.transform.db17'>, 'db18': <class 'pysap.extensions.transform.db18'>, 'db19': <class 'pysap.extensions.transform.db19'>, 'db2': <class 'pysap.extensions.transform.db2'>, 'db20': <class 'pysap.extensions.transform.db20'>, 'db21': <class 'pysap.extensions.transform.db21'>, 'db22': <class 'pysap.extensions.transform.db22'>, 'db23': <class 'pysap.extensions.transform.db23'>, 'db24': <class 'pysap.extensions.transform.db24'>, 'db25': <class 'pysap.extensions.transform.db25'>, 'db26': <class 'pysap.extensions.transform.db26'>, 'db27': <class 'pysap.extensions.transform.db27'>, 'db28': <class 'pysap.extensions.transform.db28'>, 'db29': <class 'pysap.extensions.transform.db29'>, 'db3': <class 'pysap.extensions.transform.db3'>, 'db30': <class 'pysap.extensions.transform.db30'>, 'db31': <class 'pysap.extensions.transform.db31'>, 'db32': <class 'pysap.extensions.transform.db32'>, 'db33': <class 'pysap.extensions.transform.db33'>, 'db34': <class 'pysap.extensions.transform.db34'>, 'db35': <class 'pysap.extensions.transform.db35'>, 'db36': <class 'pysap.extensions.transform.db36'>, 'db37': <class 'pysap.extensions.transform.db37'>, 'db38': <class 'pysap.extensions.transform.db38'>, 'db4': <class 'pysap.extensions.transform.db4'>, 'db5': <class 'pysap.extensions.transform.db5'>, 'db6': <class 'pysap.extensions.transform.db6'>, 'db7': <class 'pysap.extensions.transform.db7'>, 'db8': <class 'pysap.extensions.transform.db8'>, 'db9': <class 'pysap.extensions.transform.db9'>, 'dmey': <class 'pysap.extensions.transform.dmey'>, 'fbsp': <class 'pysap.extensions.transform.fbsp'>, 'gaus1': <class 'pysap.extensions.transform.gaus1'>, 'gaus2': <class 'pysap.extensions.transform.gaus2'>, 'gaus3': <class 'pysap.extensions.transform.gaus3'>, 'gaus4': <class 'pysap.extensions.transform.gaus4'>, 'gaus5': <class 'pysap.extensions.transform.gaus5'>, 'gaus6': <class 'pysap.extensions.transform.gaus6'>, 'gaus7': <class 'pysap.extensions.transform.gaus7'>, 'gaus8': <class 'pysap.extensions.transform.gaus8'>, 'haar': <class 'pysap.extensions.transform.haar'>, 'mexh': <class 'pysap.extensions.transform.mexh'>, 'morl': <class 'pysap.extensions.transform.morl'>, 'rbio11': <class 'pysap.extensions.transform.rbio11'>, 'rbio13': <class 'pysap.extensions.transform.rbio13'>, 'rbio15': <class 'pysap.extensions.transform.rbio15'>, 'rbio22': <class 'pysap.extensions.transform.rbio22'>, 'rbio24': <class 'pysap.extensions.transform.rbio24'>, 'rbio26': <class 'pysap.extensions.transform.rbio26'>, 'rbio28': <class 'pysap.extensions.transform.rbio28'>, 'rbio31': <class 'pysap.extensions.transform.rbio31'>, 'rbio33': <class 'pysap.extensions.transform.rbio33'>, 'rbio35': <class 'pysap.extensions.transform.rbio35'>, 'rbio37': <class 'pysap.extensions.transform.rbio37'>, 'rbio39': <class 'pysap.extensions.transform.rbio39'>, 'rbio44': <class 'pysap.extensions.transform.rbio44'>, 'rbio55': <class 'pysap.extensions.transform.rbio55'>, 'rbio68': <class 'pysap.extensions.transform.rbio68'>, 'shan': <class 'pysap.extensions.transform.shan'>, 'sym10': <class 'pysap.extensions.transform.sym10'>, 'sym11': <class 'pysap.extensions.transform.sym11'>, 'sym12': <class 'pysap.extensions.transform.sym12'>, 'sym13': <class 'pysap.extensions.transform.sym13'>, 'sym14': <class 'pysap.extensions.transform.sym14'>, 'sym15': <class 'pysap.extensions.transform.sym15'>, 'sym16': <class 'pysap.extensions.transform.sym16'>, 'sym17': <class 'pysap.extensions.transform.sym17'>, 'sym18': <class 'pysap.extensions.transform.sym18'>, 'sym19': <class 'pysap.extensions.transform.sym19'>, 'sym2': <class 'pysap.extensions.transform.sym2'>, 'sym20': <class 'pysap.extensions.transform.sym20'>, 'sym3': <class 'pysap.extensions.transform.sym3'>, 'sym4': <class 'pysap.extensions.transform.sym4'>, 'sym5': <class 'pysap.extensions.transform.sym5'>, 'sym6': <class 'pysap.extensions.transform.sym6'>, 'sym7': <class 'pysap.extensions.transform.sym7'>, 'sym8': <class 'pysap.extensions.transform.sym8'>, 'sym9': <class 'pysap.extensions.transform.sym9'>}#
class WaveletTransformBase(nb_scale, verbose=0, dim=2, use_wrapping=False, **kwargs)[source]#

Bases: object

Data structure representing a signal wavelet decomposition.

Available transforms are define in ‘pysap.transform’.

_set_data(data)[source]#

Set the input data array.

Parameters

data (numpy.ndarray or pysap.Image) – input data/signal.

_get_data()[source]#

Get the input data array.

Returns

data – input data/signal.

Return type

numpy.ndarray

_set_analysis_data(analysis_data)[source]#

Set the decomposition coefficients array.

Parameters

analysis_data (list) – decomposition coefficients array.

_get_analysis_data()[source]#

Get the decomposition coefficients array.

Returns

analysis_data – decomposition coefficients array.

Return type

numpy.ndarray

_set_analysis_header(analysis_header)[source]#

Set the decomposition coefficients header.

Parameters

analysis_header (dict) – decomposition coefficients array.

_get_analysis_header()[source]#

Get the decomposition coefficients header.

Returns

analysis_header – decomposition coefficients header.

Return type

dict

_get_info()[source]#

Return the transformation information. This iformation is only available when using the Python bindings.

property data#

Get the input data array.

Returns

data – input data/signal.

Return type

numpy.ndarray

property analysis_data#

Get the decomposition coefficients array.

Returns

analysis_data – decomposition coefficients array.

Return type

numpy.ndarray

property analysis_header#

Get the decomposition coefficients header.

Returns

analysis_header – decomposition coefficients header.

Return type

dict

property info#

Return the transformation information. This iformation is only available when using the Python bindings.

classmethod bands_shapes(bands_lengths, ratio=None)[source]#

Return the different bands associated shapes given there lengths.

Parameters
  • bands_lengths (numpy.ndarray (<nb_scale>, max(<nb_band_per_scale>, 0))) – array holding the length between two bands of the data vector per scale.

  • ratio (numpy.ndarray, default None) – a array containing ratios for eeach scale and each band.

Returns

bands_shapes – structure holding the shape of each bands at each scale.

Return type

list of list of 2-uplet (<nb_scale>, <nb_band_per_scale>)

show()[source]#

Display the different bands at the different decomposition scales.

analysis(**kwargs)[source]#

Decompose a real or complex signal using ISAP.

Fill the instance ‘analysis_data’ and ‘analysis_header’ parameters.

Parameters

kwargs (dict (optional)) – the parameters that will be passed to ‘pysap.extensions.mr_tansform’.

synthesis()[source]#

Reconstruct a real or complex signal from the wavelet coefficients using ISAP.

Returns

data – the reconstructed data/signal.

Return type

pysap.Image

band_at(scale, band)[source]#

Get the band at a specific scale.

Parameters
  • scale (int) – index of the scale.

  • band (int) – index of the band.

Returns

band_data – the requested band data array.

Return type

nd-arry

_init_transform()[source]#

Define the transform.

trf#

the transformation.

Type

object

_get_linear_band(scale, band, analysis_data)[source]#

Access the desired band data from a 1D linear analysis buffer.

Parameters
  • scale (int) – index of the scale.

  • band (int) – index of the band.

  • analysis_data (numpy.ndarray (N, )) – the analysis buffer.

Returns

band_data – the requested band buffer.

Return type

nd-arry (M, )

_set_linear_band(scale, band, analysis_data, band_data)[source]#

Set the desired band data in a 1D linear analysis buffer.

Parameters
  • scale (int) – index of the scale.

  • band (int) – index of the band.

  • analysis_data (numpy.ndarray (N, )) – the analysis buffer.

  • band_data (numpy.ndarray (M, M)) – the band data to be added in the analysis buffer.

Returns

analysis_data – the updated analysis buffer.

Return type

nd-arry (N, )

_set_transformation_parameters()[source]#

Define the transformation class parameters.

name#

the name of the decomposition.

Type

str

bands_names#

the name of the different bands.

Type

list of str

flatten_fct#

a function used to reorganize the ISAP decomposition coefficients, see ‘pysap/extensions/formating.py’ module for more details.

Type

callable

unflatten_fct#

a function used to reorganize the decomposition coefficients using ISAP convention, see ‘pysap/extensions/formating.py’ module for more details.

Type

callable

is_decimated#

True if the decomposition include a decimation of the band number of coefficients.

Type

bool

nb_band_per_scale#

vector of int holding the number of band per scale.

Type

numpy.ndarray (<nb_scale>, )

bands_lengths#

array holding the length between two bands of the data vector per scale.

Type

numpy.ndarray (<nb_scale>, max(<nb_band_per_scale>, 0))

bands_shapes[source]#

structure holding the shape of each bands at each scale.

Type

list of list of 2-uplet (<nb_scale>, <nb_band_per_scale>)

isap_transform_id#

the label of the ISAP transformation.

Type

int

_compute_transformation_parameters()[source]#

Compute information in order to split scale/band flatten data.

scales_lengths#

the length of each band.

Type

numpy.ndarray (<nb_scale>, )

scales_padds#

the index of the data associated to each scale.

Type

numpy.ndarray (<nb_scale> + 1, )

_analysis(data, **kwargs)[source]#

Decompose a real signal using ISAP.

Parameters
  • data (numpy.ndarray) – a real array to be decomposed.

  • kwargs (dict (optional)) – the parameters that will be passed to ‘pysap.extensions.mr_tansform’.

Returns

  • analysis_data (numpy.ndarray) – the decomposition coefficients.

  • analysis_header (dict) – the decomposition associated information.

_synthesis(analysis_data, analysis_header)[source]#

Reconstruct a real signal from the wavelet coefficients using ISAP.

Parameters
  • analysis_data (list of numpy.ndarray) – the wavelet coefficients array.

  • analysis_header (dict) – the wavelet decomposition parameters.

Returns

data – the reconstructed data array.

Return type

numpy.ndarray