WaveletTransformInverse
- class odl.trafos.wavelet.wavelet.WaveletTransformInverse(*args, **kwargs)[source]
Bases:
WaveletTransformBaseDiscrete inverse wavelet trafo between discrete L2 spaces.
See Also
WaveletTransform
- __init__(range, wavelet, nlevels=None, pad_mode='constant', pad_const=0, impl='pywt', axes=None)[source]
Initialize a new instance.
Parameters
which is the range of this inverse transform.
- waveletstring or
pywt.Wavelet Specification of the wavelet to be used in the transform. If a string is given, it is converted to a
pywt.Wavelet. Usepywt.wavelistto get a list of available wavelets.Possible wavelet families are:
'haar': Haar'db': Daubechies'sym': Symlets'coif': Coiflets'bior': Biorthogonal'rbio': Reverse biorthogonal'dmey': Discrete FIR approximation of the Meyer wavelet- nlevelspositive int, optional
Number of scaling levels to be used in the decomposition. The maximum number of levels can be calculated with
pywt.dwtn_max_level. Default: Use maximum number of levels.- pad_modestring, optional
Method to be used to extend the signal.
'constant': Fill withpad_const.'symmetric': Reflect at the boundaries, not repeating the outmost values.'periodic': Fill in values from the other side, keeping the order.'order0': Extend constantly with the outmost values (ensures continuity).'order1': Extend with constant slope (ensures continuity of the first derivative). This requires at least 2 values along each axis where padding is applied.'pywt_per': like'periodic'-padding but gives the smallest possible number of decomposition coefficients. Only available withimpl='pywt', Seepywt.Modes.modes.'reflect': Reflect at the boundary, without repeating the outmost values.'antisymmetric': Anti-symmetric variant ofsymmetric.'antireflect': Anti-symmetric variant ofreflect.For reference, the following table compares the naming conventions for the modes in ODL vs. PyWavelets:
======================= ================== ODL PyWavelets ======================= ================== symmetric symmetric reflect reflect order1 smooth order0 constant constant, pad_const=0 zero periodic periodic pywt_per periodization antisymmetric antisymmetric antireflect antireflect ======================= ==================
See signal extension modes for an illustration of the modes (under the PyWavelets naming conventions).
- pad_constfloat, optional
Constant value to use if
pad_mode == 'constant'. Ignored otherwise. Constants other than 0 are not supported by thepywtback-end.- impl{‘pywt’}, optional
Back-end for the wavelet transform.
- axessequence of ints, optional
Axes over which the DWT that created
coeffswas performed. The default value ofNonecorresponds to all axes. When not all axes are included this is analagous to a batch transform inlen(axes)dimensions looped over the non-transformed axes. In orther words, filtering and decimation does not occur along any axes not inaxes.
Examples
Check that the inverse is the actual inverse on a simple example on a discrete 2D space with 4 sampling points per axis:
>>> space = odl.uniform_discr([0, 0], [1, 1], (4, 4)) >>> wavelet_trafo = odl.trafos.WaveletTransform( ... domain=space, nlevels=1, wavelet='haar') >>> orig_array = space.element(np.array([[1, 1, 1, 1], ... [0, 0, 0, 0], ... [0, 0, 1, 1], ... [1, 0, 1, 0]])) >>> decomp = wavelet_trafo(orig_array) >>> recon = wavelet_trafo.inverse(decomp) >>> from odl.core.util.testutils import all_almost_equal >>> all_almost_equal(recon, orig_array) True
References
- waveletstring or