tfmri.signal.wavedec

wavedec(data, wavelet, mode='symmetric', level=None, axes=None)[source]

Multilevel N-dimensional discrete wavelet transform (wavelet decomposition).

Parameters
  • data – A tf.Tensor of real or complex type.

  • wavelet

    A str or a pywt.Wavelet, or a list thereof. When passed a list, different wavelets are applied along each axis in axes.

  • mode

    A str. The padding or signal extension mode. Must be one of the values supported by tf.pad. Defaults to 'symmetric'.

  • level – An int >= 0. The decomposition level. If None (default), the maximum useful level of decomposition will be used (see tfmri.signal.max_wavelet_level).

  • axes

    A list of int. Axes over which to compute the DWT. Axes may not be repeated. A value of None (the default) selects all axes.

Returns

A list of coefficients such as [approx, {details_level_n}, ..., {details_level_1}]. The first element in the list contains the approximation coefficients at level n. The remaining elements contain the detail coefficients, listed in descending order of decomposition level. Each ``details_level_i`` element is a dict containing detail coefficients at level ``i`` of the decomposition. As a concrete example, a 3D decomposition would have the following set of keys in each details_level_i dict: {'aad', 'ada', 'daa', 'add', 'dad', 'dda', 'ddd'}, where the order of the characters in each key map to the specified ``axes.

Examples

>>> import tensorflow as tf
>>> import tensorflow_mri as tfmri
>>> coeffs = tfmri.signal.wavedec(tf.ones((4, 4)), 'db1')
>>> # Levels:
>>> len(coeffs)-1
2
>>> tfmri.signal.waverec(coeffs, 'db1')
<tf.Tensor: shape=(4, 4), dtype=float32, numpy=
array([[0.9999999, 0.9999999, 0.9999999, 0.9999999],
       [0.9999999, 0.9999999, 0.9999999, 0.9999999],
       [0.9999999, 0.9999999, 0.9999999, 0.9999999],
       [0.9999999, 0.9999999, 0.9999999, 0.9999999]], dtype=float32)>