WaveletTransformInverse¶
-
class
odl.trafos.wavelet.
WaveletTransformInverse
(*args, **kwargs)[source]¶ Bases:
odl.trafos.wavelet.WaveletTransformBase
Discrete inverse wavelet trafo between discrete L2 spaces.
See also
- Attributes
adjoint
Adjoint of this operator.
domain
Set of objects on which this operator can be evaluated.
impl
Implementation back-end of this wavelet transform.
inverse
Inverse of this operator.
is_biorthogonal
Whether or not the wavelet basis is bi-orthogonal.
is_functional
True
if this operator’s range is aField
.is_linear
True
if this operator is linear.is_orthogonal
Whether or not the wavelet basis is orthogonal.
nlevels
Number of scaling levels in this wavelet transform.
pad_const
Value for extension used in
'constant'
padding mode.pad_mode
Padding mode used for extending input beyond its boundary.
range
Set in which the result of an evaluation of this operator lies.
wavelet
Name of the wavelet used in this wavelet transform.
Methods
_call
(self, coeffs)Return the inverse wavelet transform of
coeffs
.derivative
(self, point)Return the operator derivative at
point
.norm
(self[, estimate])Return the operator norm of this operator.
scales
(self)Get the scales of each coefficient.
-
__init__
(self, range, wavelet, nlevels=None, pad_mode='constant', pad_const=0, impl='pywt', axes=None)[source]¶ Initialize a new instance.
- Parameters
- range
DiscretizedSpace
Domain of the forward wavelet transform (the “image domain”), 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.wavelist
to 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 thepywt
back-end.- impl{‘pywt’}, optional
Back-end for the wavelet transform.
- axessequence of ints, optional
Axes over which the DWT that created
coeffs
was performed. The default value ofNone
corresponds 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
.
- range
References
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 = 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) >>> np.allclose(recon, orig_array) True