This section demonstrates the features of three-dimensional discrete wavelet analysis using
the Wavelet
Toolbox™ software. The toolbox provides these functions for 3-D data analysis. You
use the Wavelet 3-D tool in the **Wavelet Analyzer** app to perform all tasks
except the first task.

Getting information on the command line functions

Loading 3-D data

Analyzing a 3-D data

Selecting and displaying slices

Creating a slice movie

Creating true 3-D display

Importing and exporting information

The example `wavelet3ddemo`

and the documentation
of the *Analysis-Decomposition* and *Synthesis-Reconstruction* functions
show how you can analyze 3-D arrays efficiently using command line
functions dedicated to the 3-D wavelet analysis. For more information,
see the function reference pages.

In this section you explore the same 3-D data as in the `wavelet3ddemo`

example,
but you use the Wavelet Analyzer app.

Start the 3-D Wavelet Analysis Tool.

From the MATLAB

^{®}prompt, type`waveletAnalyzer`

.The

**Wavelet Analyzer**appears.Click the

**Wavelet 3-D**menu item. The discrete wavelet analysis tool for 3-D data opens.Load a 3-D array.

At the MATLAB command prompt, type

In the`load wmri`

**Wavelet 3-D**tool, select**File**>**Import Data**. When the**Import from Workspace**dialog box appears, select the`X`

variable. Click**OK**to import the 3-D data.Analyze the 3-D array. Using the

**Wavelet**and**Level**menus located in the upper part of the tool, specify:

The wavelet families (one per direction X, Y and Z)

The decomposition level and the wavelet extension mode to be used for the analysis

For this analysis, accept the defaults:

`db1`

wavelet for each direction, decomposition at level`2`

and symmetric extension mode (`sym`

).Click

**Decompose**. After a pause for computation, the**Wavelet 3-D**tool displays its analysis.Review the slices of data and wavelet components in the graphical display. These slices are orthogonal to the

*z*-direction as indicated by**Slice Orientation**in the command part of the window. This option lets you choose the desired slice orientation.The first row of the graphical display area displays from left to right and for

**Z = 1**:The original data slice

The approximation at level 2 slice (low-pass component

`APP2`

)The slice which is the sum of all the components from level 1 to level 2, different from the lowpass one.

The

*x*-labels of the three axes give you the name and the size of the displayed data.

The next two lines of axes, display the wavelet coefficients
at level 2, which is the desired level of the analysis. In the first
line, the first graph contains the coefficients of approximation at
level 2. The remaining seven axes display the seven types of wavelet
coefficients at level 2. These coefficients contain the *x*-labels
of the eight axes and display the name, type and size of the displayed
data.

For example, in the third graphic of the bottom line, you can
see the `Cfs-DAD`

coefficients at level 2, which
correspond to an array of size 32 x 32 x 7. The name of the `DAD`

coefficients
group indicates that it is obtained using

The highpass filter in the

*x*-direction (`D`

) for detailThe lowpass filter in the

*y*-direction (`A`

) for approximationThe highpass filter in the

*z*-direction (`D`

), leading to the`DAD`

componentYou use the

**Displayed Level**in the command part of the window to choose the level of the displayed component, from 1 to the decomposition level.You can modify characteristics of the display using the options in the command part of the window. Each pair of sliders controls part of graphical array, the original and the reconstructed slices with the first pair or the coefficients slices with the second pair. Above each slider you can see the number of slices in the current slice orientation.

Using the slider (or by directly editing the values) of

**Rec. Z-Slice**, choose slice number twelve. Similarly, choose slice number two using**Cfs. Z-Slice**.The

**Slice Movie**button lets you see a movie of all the slices, first for the reconstructed slices and then for the coefficients slices. In this case, the movie contains 27 reconstructed images and 7 coefficients images.**3D Display**lets you examine the original data and the wavelet components in true 3-D mode. Click**3D Display**and select`APP1`

.A rotated 3-D view of the approximation at level 1 opens in a new window. Use the sliders in the 3-D tool to examine the 3-D data.

You can import information from and export information either
to disk or to the workspace using the **Wavelet
3-D** graphical tool.

To load 3-D data you have constructed in your MATLAB workspace
into the **Wavelet 3-D** tool, save the
3-D data in a MAT-file, using

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

where `M`

and `X`

are

Name | Size | Bytes | Class |
---|---|---|---|

`M` | `8x8` | `512` | `double` |

`X` | `8x8x8` | `4096` | `double` |

To load this 3-D data into the **Wavelet
3-D** tool, use the menu option **File > Load Data**.
You then select the MAT-file to load.

Similarly, you can load information from the workspace using **File > Import Data**. You then select the variable to load.

You can save decompositions and approximations from the **Wavelet 3-D** tool to a file or to the workspace.

**Saving Decompositions. **The **Wavelet 3-D** tool lets you
save the entire set of data from a discrete wavelet analysis to a
file. The toolbox creates a MAT-file in the current folder with a
name you choose.

Open the

**Wavelet 3-D**tool with**File > Load Data**, and select magic3d to load the 3-D data file.After analyzing your data, save it by using

**File > Save > Decomposition**.In the dialog box that appears, specify a folder and file name for storing the decomposition data. Type the name

`dec_magic3d`

.After saving the decomposition data to the file

`dec_magic3d.mat`

, load the variables into your workspace.load dec_magic3d whos

where wdec is

Name | Size | Bytes | Class |
---|---|---|---|

`wdec` | `1x1` | `9182` | `struct` |

The variable wdec contains the wavelet decomposition structure.

wdec = sizeINI: [8 8 8] level: 2 filters: [1x1 struct] mode: 'sym' dec: {15x1 cell} sizes: [3x3 double]

**Saving Approximations. **You can process a 3-D data in the **Wavelet
3-D** tool and then save any desired approximation, depending
on the level chosen for the decomposition.

Open the

**Wavelet 3-D**tool and load the file containing the 3-D data to analyze by using**File > Load Data**Select magic3d.

Select the

**File > Save > Approximations > Approximation at level 2**menu option.In the dialog box that appears, select a folder and file name for the MAT-file. For this example, choose the name

`App2_magic3D`

.Load the image data into your workspace.

load App2_magic3D whos

where `x`

is

Name | Size | Bytes | Class |
---|---|---|---|

`x` | `8x8x8` | `4096` | `double` |