Documentation

wavedec3

3-D wavelet decomposition

Syntax

WDEC = wavedec3(X,N,wname)
WDEC = wavedec3(X,N,wname,'mode','ExtM')
WDEC = wavedec3(X,N,{LoD,HiD,LoR,HiR})

Description

wavedec3 is a three-dimensional wavelet analysis function.

WDEC = wavedec3(X,N,wname) returns the wavelet decomposition of the 3-D array X at level N, using the wavelet specified by the character vector or string scalar wname or the particular wavelet filters you specify. It uses the default extension mode 'sym'. See dwtmode. N must be a positive integer.

WDEC = wavedec3(X,N,wname,'mode','ExtM') uses the specified DWT extension mode .

WDEC = wavedec3(X,N,{LoD,HiD,LoR,HiR}) uses the decomposition and reconstruction filters you specify in a cell array.

WDEC is the output decomposition structure, with the following fields:

 sizeINI Size of the three-dimensional array X level Level of the decomposition mode Name of the wavelet transform extension mode filters Structure with 4 fields, LoD, HiD, LoR, HiR, which contain the filters used for the DWT. dec N x 1 cell array containing the coefficients of the decomposition. N is equal to 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. sizes Successive sizes of the decomposition components

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');

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');

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 