waverec3

3-D wavelet reconstruction

Syntax

X = waverec3(WDEC)
C = waverec3(WDEC,TYPE,N)
X = waverec3(WDEC,'a',0)
X = waverec3(WDEC,'ca',0)
C = waverec3(WDEC,TYPE)
C = waverec3(WDEC,TYPE,N)

Description

waverec3 performs a multilevel 3-D wavelet reconstruction starting from a multilevel 3-D wavelet decomposition.

X = waverec3(WDEC) reconstructs the 3-D array X based on the multilevel wavelet decomposition structure WDEC. You can also use waverec3 to extract coefficients from a 3-D wavelet decomposition.

WDEC is a structure with the fields shown in the table.

C = waverec3(WDEC,TYPE,N) reconstructs the multilevel components at level N of a 3-D wavelet decomposition. N must be a positive integer less than or equal to the level of the decomposition.

Valid values for TYPE are:

  • A group of three characters 'xyz', one per direction, with 'x','y' and 'z' selected in the set {'a', 'd', 'l', 'h'} or in the corresponding uppercase set {'A','D', 'L', 'H'}), where 'A' (or 'L') is a low-pass filter and 'D' (or 'H') is a high-pass filter.

  • The char 'd' (or 'h' or 'D' or 'H') gives the sum of all the components different from the low-pass.

  • The char 'a' (or 'l' or 'A' or 'L') gives the low-pass component (the approximation at level N).

For extraction, the valid values for TYPE are the same but prefixed by 'c' or 'C'.

X = waverec3(WDEC,'a',0) or X = waverec3(WDEC,'ca',0) is equivalent to X = waverec3(WDEC). X is a reconstruction of the coefficients in WDEC at level 0.

C = waverec3(WDEC,TYPE) is equivalent to C = waverec3(WDEC,TYPE,N) with N equal to the level of the decomposition.

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, and HiR, which contain the filters used for 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

Construct a 3-D matrix, obtain the wavelet transform down to level 2 using the 'db2' wavelet, and reconstruct the matrix to verify perfect reconstruction.

Create 3-D matrix.

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

Obtain the 3-D discrete wavelet transform of the matrix and reconstruct the input based on the 3-D approximation and detail coefficients.

wd = wavedec3(X,2,'db2');
XR = waverec3(wd);

Verify perfect reconstruction using the wavelet decomposition down to level 2.

err1 = max(abs(X(:)-XR(:)))
err1 = 8.6057e-11

Verify that the data matrix is the sum of the approximation and the details from levels 2 and 1. Reconstruct the sum of components different from the lowpass component and check that X = A + D.

A = waverec3(wd,'LLL');
D = waverec3(wd,'d');
err2 = max(abs(X(:)-A(:)-D(:)))
err2 = 8.6054e-11

Compare level-1 reconstructions based on the filtering operations 'LLH' using idwt3 and waverec3.

M = magic(8);
X = repmat(M,[1 1 8]);
wd = wavedec3(X,2,'db2','mode','per');
dwtOut = dwt3(X,'db2');
Xr = idwt3(dwtOut,'LLH');
Xrec = waverec3(wd,'LLH',1);
norm(Xr(:)-Xrec(:))
ans = 2.7511e-14

See Also

| |

Introduced in R2010a