Main Content

wavedec3

Multilevel 3-D discrete wavelet transform

    Description

    example

    wdec = wavedec3(x,n,wname) returns the wavelet decomposition of the 3-D array x at level n, using the wavelet specified by wname. wavedec3 uses the default extension mode 'sym'.

    example

    wdec = wavedec3(x,n,wname,'mode',extmode) uses the specified extension mode extmode.

    example

    wdec = wavedec3(x,n,{LoD,HiD,LoR,HiR}) uses the specified decomposition and reconstruction filters LoD,HiD and LoR,HiR, respectively.

    Examples

    collapse all

    Find the 3-D DWT of a volume. Construct 8-by-8-by-8 matrix of integers 1 to 64 and make the data 3-D.

    M = magic(8);
    X = repmat(M,[1 1 8]);

    Obtain the 3-D discrete wavelet transform at level 1 using the Haar wavelet and the default whole-point symmetric extension mode.

    wd1 = wavedec3(X,1,'db1');

    Compare the output of wavedec3 and dwt3 to illustrate the ordering of the 3-D wavelet coefficients described in the dec field description.

    X = reshape(1:512,8,8,8);
    dwtOut = dwt3(X,'db1','mode','per');
    wdec = wavedec3(X,1,'db1','mode','per');
    max(abs((wdec.dec{4}(:)-dwtOut.dec{2,2,1}(:))))
    ans = 0
    
    max(abs((wdec.dec{5}(:)-dwtOut.dec{1,1,2}(:))))
    ans = 0
    

    Specify the decomposition and reconstruction filters as a cell array. Construct 8-by-8-by-8 matrix of integers 1 to 64 and make the data 3-D.

    M = magic(8);
    X = repmat(M,[1 1 8]);

    Obtain the 3-D discrete wavelet transform down to level 2 using the Daubechies extremal phase wavelet with two vanishing moments. Input the decomposition and reconstruction filters as a cell array. Use the periodic extension mode.

    [LoD,HiD,LoR,HiR] = wfilters('db2');
    wd2 = wavedec3(X,2,{LoD,HiD,LoR,HiR},'mode','per');

    Input Arguments

    collapse all

    Input data, specified as a 3-D array.

    Data Types: double

    Decomposition level, specified as a positive integer. wavedec3 does not enforce a maximum level restriction. See wmaxlev.

    Data Types: double

    Analyzing wavelet, specified as a character vector or string scalar.

    Note

    wavedec3 supports only Type 1 (orthogonal) or Type 2 (biorthogonal) wavelets. See wfilters for a list of orthogonal and biorthogonal wavelets.

    Extension mode used when performing the wavelet decomposition, specified as one of the following:

    mode

    DWT Extension Mode

    'zpd'

    Zero extension

    'sp0'

    Smooth extension of order 0

    'spd' (or 'sp1')

    Smooth extension of order 1

    'sym' or 'symh'

    Symmetric extension (half point): boundary value symmetric replication

    'symw'

    Symmetric extension (whole point): boundary value symmetric replication

    'asym' or 'asymh'

    Antisymmetric extension (half point): boundary value antisymmetric replication

    'asymw'

    Antisymmetric extension (whole point): boundary value antisymmetric replication

    'ppd', 'per'

    Periodized extension

    If the signal length is odd and mode is 'per', an extra sample equal to the last value is added to the right and the extension is performed in 'ppd' mode. If the signal length is even, 'per' is equivalent to 'ppd'. This rule also applies to images.

    The global variable managed by dwtmode specifies the default extension mode. See dwtmode for extension mode descriptions.

    Wavelet decomposition filters associated with an orthogonal or biorthogonal wavelet, specified as even-length real-valued vectors. LoD is the lowpass decomposition filter, and HiD is the highpass decomposition filter. See wfilters for details.

    Wavelet reconstruction filters associated with an orthogonal or biorthogonal wavelet, specified as even-length real-valued vectors. LoR is the lowpass reconstruction filter, and HiR is the highpass reconstruction filter. See wfilters for details.

    Output Arguments

    collapse all

    Wavelet output decomposition, returned as a structure with the following fields:

    Input data size, returned as a 1-by-3 vector.

    Level of the decomposition, returned as an integer.

    Name of the wavelet transform extension mode, returned as a character vector.

    Wavelet filters used for the decomposition, returned as a structure with the following fields:

    • LoD — lowpass decomposition filter

    • HiD — highpass decomposition filter

    • LoR — lowpass decomposition filter

    • HiR — highpass decomposition filter

    Decomposition coefficients, returned as an N-by-1 cell array, where N equals 7 wdec.level+1.

    dec{1} contains the lowpass component (approximation) at the level of the decomposition. The approximation is equivalent to the filtering operations 'LLL'.

    dec{k+2},...,dec{k+8} with k = 0,7,14,...,7*(wdec.level-1) contain the 3-D wavelet coefficients for the multiresolution starting with the coarsest level when k=0.

    For example, if wdec.level=3, dec{2},...,dec{8} contain the wavelet coefficients for level 3 (k=0), dec{9},...,dec{15} contain the wavelet coefficients for level 2 (k=7), and dec{16},...,dec{22} contain the wavelet coefficients for level 1 (k=7*(wdec.level-1)).

    At each level, the wavelet coefficients in dec{k+2},...,dec{k+8} are in the following order: 'HLL','LHL','HHL','LLH','HLH','LHH','HHH'.

    The sequence of letters gives the order in which the separable filtering operations are applied from left to right. For example, 'LHH' means that the lowpass (scaling) filter with downsampling is applied to the rows of x, followed by the highpass (wavelet) filter with downsampling applied to the columns of x. Finally, the highpass filter with downsampling is applied to the 3rd dimension of x.

    Successive sizes of the decomposition components, returned as an n+1-by-2 matrix.

    Version History

    Introduced in R2010a