A Julia extension package to Wavelets.jl
Author UCD4IDS
3 Stars
Updated Last
1 Year Ago
Started In
April 2021


Docs Build Test
CI codecov

This package is a Julia extension package to Wavelets.jl (WaveletsExt is short for Wavelets Extension). It contains additional functionalities that complement Wavelets.jl, which include multiple best basis algorithms, denoising methods, Local Discriminant Basis (LDB), Stationary Wavelet Transform, Autocorrelation Wavelet Transform (ACWT), and the Shift Invariant Wavelet Decomposition.


This package is written and maintained by Zeng Fung Liew and Shozen Dan under the supervision of Professor Naoki Saito at the University of California, Davis.


The package is part of the official Julia Registry. It can be install via the Julia REPL.

(@1.6) pkg> add WaveletsExt


julia> using Pkg; Pkg.add("WaveletsExt")


Load the WaveletsExt module along with Wavelets.jl.

using Wavelets, WaveletsExt

Wavelet Packet Decomposition

In contrast to Wavelets.jl's wpt function, wpd outputs expansion coefficients of all levels of a given signal. Each column represents a level in the decomposition tree.

y = wpd(x, wavelet(WT.db4))

Stationary Wavelet Transform

The redundant and non-orthogonal transform by Nason-Silverman can be implemented using either sdwt (for stationary discrete wavelet transform) or iswpd (for stationary wavelet packet decomposition). Similarly, the reconstruction of signals can be computed using isdwt and iswpt.

# stationary discrete wavelet transform
y = sdwt(x, wavelet(WT.db4))
z = isdwt(y, wavelet(WT.db4))

# stationary wavelet packet decomposition
y = swpd(x, wavelet(WT.db4))
z = iswpt(y, wavelet(WT.db4))

Autocorrelation Wavelet Transform

The autocorrelation wavelet transform (ACWT) is a special case of the stationary wavelet transform. Some desirable properties of ACWT are symmetry without losing vanishing moments, edge detection/characterization capabilities, and shift invariance. To transform a signal using AC wavelets, use acwt (discreate AC wavelet transform) or acwpt (a.c. packet transform). acwt can also handle 2D signals, which is useful in applications such as image denoising or compression. The reconstruction of signals can be performed using iacwt and iacwpt.

# autocorrelation discrete wavelet transform
y = acwt(x, wavelet(WT.db4))
z = iacwt(y)

# autocorrelation wavelet packet transform
tree = maketree(x, :full)
y = acwpt(x, wavelet(WT.db4))
z = iacwpt(y, tree)

Best Basis

In addition to the best basis algorithm by M.V. Wickerhauser implemented in Wavelets.jl, WaveletsExt.jl contains the implementation of the Joint Best Basis (JBB) by Wickerhauser an the Least Statistically-Dependent Basis (LSDB) by Saito.

y = cat([wpd(x[:,i], wt) for i in N]..., dims=3)    # x has size (2^L, N)

# individual best basis trees
bbt = bestbasistree(y, BB())
# joint best basis
bbt = bestbasistree(y, JBB())
# least statistically dependent basis
bbt = bestbasistree(y, LSDB())

Given a BitVector representing a best basis tree, one can obtain the corresponding expansion coefficients using bestbasiscoef.

coef = bestbasiscoef(y, bbt)

Local Discriminant Basis

Local Discriminant Basis (LDB) is a feature extraction method developed by Naoki Saito.

X, y = generateclassdata(ClassData(:tri, 5, 5, 5))
wt = wavelet(WT.haar)

f = LocalDiscriminantBasis(wt, top_k=5, n_features=5)
Xt = fit_transform(f, X, y)

TODO(By v0.2.0):

  • Improve webpage "Manual" documentation

TODO(long term):

  • Inverse Transforms for Shift-Invariant WPT
  • Better documentation.

Used By Packages

No packages found.