Main Content

mswcmp

Multisignal 1-D compression using wavelets

Description

mswcmp computes thresholds and, depending on the selected option, performs compression of 1-D signals using wavelets.

[xc,deccmp,thresh] = mswcmp('cmp',dec,mthd) returns a compressed version xc of the original multisignal x, whose wavelet decomposition structure is dec. The compression method is specified by mthd. The output xc is obtained by thresholding the wavelet coefficients. The output deccmp is the wavelet decomposition associated with xc, and thresh is the matrix of threshold values.

[xc,deccmp,thresh] = mswcmp('cmp',dec,mthd,param) uses the parameter param associated with mthd, if required.

example

[xc,thresh] = mswcmp('cmpsig',___) returns the compressed multisignal and computed thresholds if 'cmp' in the first or second syntaxes is replaced with 'cmpsig'.

[deccmp,thresh] = mswcmp('cmpdec',___) returns the wavelet decomposition associated with the compressed multisignal and computed thresholds if 'cmp' in the first or second syntaxes is replaced with 'cmpdec'.

thresh = mswcmp('thr',___) returns the computed thresholds if 'cmp' in the first or second syntaxes is replaced with 'thr'.

[___] = mswcmp(option,dirdec,x,wname,lev,mthd) decomposes the multisignal x to level lev using the wavelet specified by wname in the direction dirdec before performing a compression or computing the thresholds.

[___] = mswcmp(option,dirdec,x,wname,lev,mthd,param) uses the parameter param associated with mthd, if required.

[___] = mswcmp(___,s_or_h) applies the threshold rule specified by s_or_h.

[___] = mswcmp(___,s_or_h,keepapp) either keeps the approximation coefficients (true) or does not (false).

[___] = mswcmp(___,s_or_h,keepapp,idxsig) is a vector, which contains the indices of the initial signals.

Examples

collapse all

Load the 23-channel EEG data Espiga3 [8]. The channels are arranged column-wise. The data is sampled at 200 Hz.

load Espiga3

Perform a decomposition at level 2 using the db2 wavelet.

dec = mdwtdec('c',Espiga3,2,'db2');

Compress the signals to obtain a percentage of zeros near 95% for the wavelet coefficients.

[xr,deccmp,thresh] = mswcmp('cmp',dec,'N0_perf',95);

Plot an original signal, and the corresponding compressed signal.

idx = 3;
plot(Espiga3(:,idx),'r')
hold on
plot(xr(:,idx),'b')
grid on
legend('Original','Compressed')

Figure contains an axes object. The axes object contains 2 objects of type line. These objects represent Original, Compressed.

Input Arguments

collapse all

Wavelet decomposition, specified as a structure. dec is the output of mdwtdec.

Compression method, specified as one of the values listed here. For methods that use an associated parameter, the range of allowable param values is shown.

For methods listed in the following table, param is a sparsity parameter, and it should be specified such that 1 ≤ param ≤ 10. For the 'scarce' method no control is done.

methodDescription
'scarce'Scarce, param (any number)
'scarcehi'Scarce high, 2.5 ≤ param ≤ 10
'scarceme'Scarce medium, 1.5 ≤ param ≤ 2.5
'scarcelo'Scarce low, 1 ≤ param ≤ 2
'rem_n0'Remove near 0
'bal_sn'Balance sparsity-norm
'sqrtbal_sn'Balance sparsity-norm (sqrt)

For methods listed in the following table, param is a real number, which represents the required performance: 0 ≤ param ≤ 100.

methodDescription
'L2_perf'Energy ratio
'N0_perf'Zero coefficients ratio

To apply a global threshold for compression, specify the method 'glb_thr' and any positive real number param.

To apply a manual compression method, specify the method 'man_thr', and specify param as an NbSig-by-NbLev or an NbSig-by-(NbLev+1) real-valued matrix, where NbSig is the number of signals, and NbLev the number of levels of decomposition.

  • param(i,j) is the threshold for the detail coefficients of level j for the ith signal (1 ≤ jNbLev).

  • param(i,NbLev+1) is the threshold for the approximation coefficients for the ith signal (if keepapp is 0).

Parameter associated with the compression method mthd, specified as a real number or a real-valued matrix. For additional information, see mthd.

Compression outputs option, specified as one of the values listed here.

optionDescription
'cmp'Return the compressed signal, the associated wavelet decomposition, and the thresholds.
'cmpsig'Return the compressed signal, and the thresholds.
'cmpdec'Return the wavelet decomposition associated with the compressed signal, and the thresholds.
'thr'Return the thresholds.

Direction indicator of the wavelet decomposition, specified as one of the following:

  • 'r': Take the 1-D wavelet decomposition of each row of x

  • 'c': Take the 1-D wavelet decomposition of each column of x

Multisignal, specified as a real-valued matrix.

Data Types: double

Analyzing wavelet, specified as a character vector or string scalar. The wavelet must be orthogonal or biorthogonal. Orthogonal and biorthogonal wavelets are designated as type 1 and type 2 wavelets respectively in the wavelet manager, wavemngr.

  • Valid built-in orthogonal wavelet families are: Best-localized Daubechies ("bl"), Beylkin ("beyl"), Coiflets ("coif"), Daubechies ("db"), Fejér-Korovkin ("fk"), Haar ("haar"), Han linear-phase moments ("han"), Morris minimum-bandwidth ("mb"), Symlets ("sym"), and Vaidyanathan ("vaid").

  • Valid built-in biorthogonal wavelet families are: Biorthogonal Spline ("bior"), and Reverse Biorthogonal Spline ("rbio").

For a list of wavelets in each family, see wfilters. You can also use waveinfo with the wavelet family short name. For example, waveinfo("db"). Use wavemngr("type",wn) to determine if the wavelet wn is orthogonal (returns 1) or biorthogonal (returns 2). For example, wavemngr("type","db6") returns 1.

Level of decomposition, specified as a positive integer. mdwtdec does not enforce a maximum level restriction. Use wmaxlev to ensure that the wavelet coefficients are free from boundary effects. If boundary effects are not a concern, a good rule is to set lev less than or equal to fix(log2(length(N))), where N is the number of samples in the 1-D data.

Type of thresholding to perform, specified as either of the following:

  • 's' — Soft thresholding

  • 'h' — Hard thresholding

Threshold approximation setting:

  • 0 — Approximation coefficients are thresholded

  • 1 — Approximation coefficients are not thresholded

Indices of initial signals, specified as a vector of positive integers, or 'all'.

Output Arguments

collapse all

Compressed multisignal, returned as a real-valued matrix.

Wavelet decomposition of the compressed multisignal x, returned as a structure with the following fields:

  • dirDec — Direction indicator: 'r' (row) or 'c' (column)

  • level — Level of wavelet decomposition

  • wname — Wavelet name

  • dwtFilters — Structure with four fields: LoD, HiD, LoR, and HiR

  • dwtEXTM — DWT extension mode

  • dwtShift — DWT shift parameter (0 or 1)

  • dataSize — Size of x

  • ca — Approximation coefficients at level lev

  • cd — Cell array of detail coefficients, from level 1 to level lev

The coefficients ca and cd{k}, for k from 1 to lev, are matrices and are stored in rows if dirdec = 'r' or in columns if dirdec = 'c'.

Threshold values used in the compression, returned as a real-valued matrix.

References

[1] Birgé, L., and P. Massart. “From Model Selection to Adaptive Estimation.” Festschrift for Lucien Le Cam: Research Papers in Probability and Statistics (E. Torgersen, D. Pollard, and G. Yang, eds.). New York: Springer-Verlag, 1997, pp. 55–88.

[2] DeVore, R. A., B. Jawerth, and B. J. Lucier. “Image Compression Through Wavelet Transform Coding.” IEEE Transactions on Information Theory. Vol. 38, Number 2, 1992, pp. 719–746.

[3] Donoho, D. L. “Progress in Wavelet Analysis and WVD: A Ten Minute Tour.” Progress in Wavelet Analysis and Applications (Y. Meyer, and S. Roques, eds.). Gif-sur-Yvette: Editions Frontières, 1993.

[4] Donoho, D. L., and I. M. Johnstone. “Ideal Spatial Adaptation by Wavelet Shrinkage.” Biometrika. Vol. 81, pp. 425–455, 1994.

[5] Donoho, D. L., I. M. Johnstone, G. Kerkyacharian, and D. Picard. “Wavelet Shrinkage: Asymptopia?” Journal of the Royal Statistical Society, series B, Vol. 57, No. 2, pp. 301–369, 1995.

[6] Donoho, D. L., and I. M. Johnstone. “Ideal denoising in an orthonormal basis chosen from a library of bases.” C. R. Acad. Sci. Paris, Ser. I, Vol. 319, pp. 1317–1322, 1994.

[7] Donoho, D. L. “De-noising by Soft-Thresholding.” IEEE Transactions on Information Theory. Vol. 42, Number 3, pp. 613–627, 1995.

[8] Mesa, Hector. “Adapted Wavelets for Pattern Detection.” In Progress in Pattern Recognition, Image Analysis and Applications, edited by Alberto Sanfeliu and Manuel Lazo Cortés, 3773:933–44. Berlin, Heidelberg: Springer Berlin Heidelberg, 2005. https://doi.org/10.1007/11578079_96.

Version History

Introduced in R2007a