# dtfilters

Analysis and synthesis filters for oversampled wavelet filter banks

## Syntax

``df = dtfilters(name)``
``````[df,rf] = dtfilters(name)``````

## Description

example

````df = dtfilters(name)` returns the decomposition (analysis) filters corresponding to `name`. These filters are used most often as input arguments to `dddtree` and `dddtree2`.```
``````[df,rf] = dtfilters(name)``` returns the reconstruction (synthesis) filters corresponding to `name`.```

## Examples

collapse all

Obtain valid filters for the complex dual-tree wavelet transform. The transform uses Farras nearly symmetric filters for the first stage and Kingsbury Q-shift filters with 10 taps for subsequent stages.

Load the noisy Doppler signal. Obtain the filters for the first and subsequent stages of the complex dual-tree wavelet transform. Demonstrate perfect reconstruction using the complex dual-tree wavelet transform.

```load noisdopp; df = dtfilters("dtf2"); dt = dddtree("cplxdt",noisdopp,5,df{1},df{2}); xrec = idddtree(dt); max(abs(noisdopp-xrec))```
```ans = 1.3056e-13 ```

Obtain valid filters for the double-density wavelet transform.

Load the noisy Doppler signal. Obtain the filters for the double-density wavelet transform. The double-density wavelet transform uses the same filters at all stages. Demonstrate perfect reconstruction using the double-density wavelet transform.

```df = dtfilters("filters1"); load noisdopp; dt = dddtree("ddt",noisdopp,5,df,df); xrec = idddtree(dt); max(abs(noisdopp-xrec))```
```ans = 2.3892e-13 ```

Load a 1-D signal.

```load noisdopp x = noisdopp;```

`"dwt"` - Critically sampled discrete wavelet transform

The critically sampled discrete wavelet transform can be applied to 1-D and 2-D data. The filter can be any valid orthogonal or biorthogonal wavelet name, or `"farras"`.

Specify a valid filter name. Use `dtfilters` to obtain the corresponding decomposition filters. Confirm the decomposition filters are returned as a two-column matrix.

```fname = "db4"; df = dtfilters(fname); df```
```df = 8×2 -0.0106 -0.2304 0.0329 0.7148 0.0308 -0.6309 -0.1870 -0.0280 -0.0280 0.1870 0.6309 0.0308 0.7148 -0.0329 0.2304 -0.0106 ```

Use `dddtree` to obtain two wavelet decompositions of the 1-D signal. Use the filter name for the first decomposition, and the filters for the second decomposition.

```wtA = dddtree("dwt",x,3,fname); wtB = dddtree("dwt",x,3,df,df);```

Confirm the wavelet coefficients in the decompositions are equal.

```for k=1:length(wtA.cfs) t = max(abs(wtA.cfs{k}(:)-wtB.cfs{k}(:))); fprintf("level %d maximum difference: %f\n",k,t) end```
```level 1 maximum difference: 0.000000 level 2 maximum difference: 0.000000 level 3 maximum difference: 0.000000 level 4 maximum difference: 0.000000 ```

Confirm the filters in both decompositions are equal.

`max(abs(wtA.filters.FDf(:)-wtB.filters.FDf(:)))`
```ans = 0 ```
`max(abs(wtA.filters.Df(:)-wtB.filters.Df(:)))`
```ans = 0 ```
`max(abs(wtA.filters.FRf(:)-wtB.filters.FRf(:)))`
```ans = 0 ```
`max(abs(wtA.filters.Rf(:)-wtB.filters.Rf(:)))`
```ans = 0 ```

`"ddt"` - Double-density wavelet transform

The double-density wavelet transform can be applied to 1-D and 2-D data. Valid filter names for the double-density wavelet transform are `"filters1"`, `"filters2"`, and `"doubledualfilt"`.

Use `dtfilters` to obtain the filters corresponding to `"filters1"`. Inspect the filters. Confirm the decomposition filters are returned as a three-column matrix.

```fname = "filters1"; df = dtfilters(fname); df```
```df = 6×3 0.1430 -0.0185 -0.0460 0.5174 -0.0669 -0.1666 0.6396 -0.0739 0.0031 0.2443 0.0004 0.6776 -0.0755 0.5811 -0.4681 -0.0546 -0.4222 0 ```

Use `dddtree` to obtain two wavelet decompositions of the 1-D signal. Use the filter name for the first decomposition, and the filters for the second decomposition.

```wtA = dddtree("ddt",x,3,fname); wtB = dddtree("ddt",x,3,df,df);```

Confirm the filters in both decompositions are equal.

`max(abs(wtA.filters.FDf(:)-wtB.filters.FDf(:)))`
```ans = 0 ```
`max(abs(wtA.filters.Df(:)-wtB.filters.Df(:)))`
```ans = 0 ```
`max(abs(wtA.filters.FRf(:)-wtB.filters.FRf(:)))`
```ans = 0 ```
`max(abs(wtA.filters.Rf(:)-wtB.filters.Rf(:)))`
```ans = 0 ```

Use `dtfilters` to obtain the filters corresponding to `"doubledualfilt"`. Inspect the filters. Confirm the decomposition filters are returned as 1-by-2 cell array consisting of three-column matrices.

```fname = "doubledualfilt"; df = dtfilters(fname); df```
```df=1×2 cell array {10x3 double} {10x3 double} ```

Use `dddtree` to obtain two wavelet decompositions of the 1-D signal. Use the filter name for the first decomposition, and the filters for the second decomposition.

```wtA = dddtree("ddt",x,3,fname); wtB = dddtree("ddt",x,3,df{1},df{2});```

Confirm the filters in both decompositions are equal.

`max(abs(wtA.filters.FDf(:)-wtB.filters.FDf(:)))`
```ans = 0 ```
`max(abs(wtA.filters.Df(:)-wtB.filters.Df(:)))`
```ans = 0 ```
`max(abs(wtA.filters.FRf(:)-wtB.filters.FRf(:)))`
```ans = 0 ```
`max(abs(wtA.filters.Rf(:)-wtB.filters.Rf(:)))`
```ans = 0 ```

`"realdt"` - Real oriented dual-tree wavelet transform

The real oriented dual-tree wavelet transform can only be applied to 2-D data. Valid filter names are:

• Any orthogonal or biorthogonal wavelet name, but only as a first-stage filter.

• `"dtfP"`, where `P` can equal 1, 2, 3, 4, or 5.

• `"FSfarras"`, but only as a first-stage filter.

• `"qshiftN"`, where `N` can equal 6, 10, 14, 16, or 18, for stages > 1.

Obtain a 2-D image.

`x2 = x'*x;`

Use `dtfilters` to obtain the decomposition filters corresponding to `"dtf1"`. Confirm the filters are returned as 1-by-2 cell array consisting of 1-by-2 cell arrays.

`dtf = dtfilters("dtf1")`
```dtf=1×2 cell array {1x2 cell} {1x2 cell} ```

Obtain the filters corresponding to `"FSfarras"` and `"qshift6"`. Confirm the filters are returned as 1-by-2 cell array consisting of two-column matrices.

`fs = dtfilters("FSfarras")`
```fs=1×2 cell array {10x2 double} {10x2 double} ```
`qs = dtfilters("qshift6")`
```qs=1×2 cell array {10x2 double} {10x2 double} ```

Confirm the `dtf` filters are equal to the `fs` and `qs` filters.

`max(abs(dtf{1}{1}(:) - fs{1}(:)))`
```ans = 0 ```
`max(abs(dtf{1}{2}(:) - fs{2}(:)))`
```ans = 0 ```
`max(abs(dtf{2}{1}(:) - qs{1}(:)))`
```ans = 0 ```
`max(abs(dtf{2}{2}(:) - qs{2}(:)))`
```ans = 0 ```

Use `dddtree2` to obtain two `realdt` decompositions of the image. Use the filter name "`dtf1"` for the first decomposition, and the filters `fs` and `qs` for the second decomposition. Confirm the wavelet coefficients in both decompositions are equal.

```wtA = dddtree2("realdt",x2,4,"dtf1"); wtB = dddtree2("realdt",x2,4,fs,qs); for k=1:length(wtA.cfs) t = max(abs(wtB.cfs{k}(:)-wtA.cfs{k}(:))) end```
```t = 0 ```
```t = 0 ```
```t = 0 ```
```t = 0 ```
```t = 0 ```

`"cplxdt"` - Complex oriented dual-tree wavelet transform

The complex oriented dual-tree wavelet transform can be applied to 1-D and 2-D data. Valid filter names are:

• Any orthogonal or biorthogonal wavelet name, but only as a first-stage filter.

• `"dtfP"`, where `P` can equal 1, 2, 3, 4, or 5.

• `"FSfarras"`, but only as a first-stage filter.

• `"qshiftN"`, where `N` can equal 6, 10, 14, 16, or 18, for stages > 1.

Use `dtfilters` to obtain the decompositions filters corresponding to the `db4` orthogonal wavelet and the Kingsbury Q-shift filter with 14 taps.

`wf = dtfilters("db2")`
```wf = 4×2 -0.1294 -0.4830 0.2241 0.8365 0.8365 -0.2241 0.4830 -0.1294 ```
`qf = dtfilters("qshift14")`
```qf=1×2 cell array {14x2 double} {14x2 double} ```

Use `dddtree` and the filters to obtain the complex oriented dual-tree wavelet decomposition of the 1-D signal.

`wtA = dddtree("cplxdt",x,4,{wf,wf},qf);`

Demonstrate perfect reconstruction.

```xrec = idddtree(wtA); max(abs(xrec(:)-x(:)))```
```ans = 3.4159e-12 ```

`"realdddt"` - Real double-density dual-tree wavelet transform

The real double-density dual-tree wavelet transform can only be applied to 2-D data. Valid filter names are:

• `"dddtf1"`

• `"self1"`

• `"self2"`

Use `dtfilters` to obtain the decomposition filters corresponding to `"dddtf1"`. Confirm the filters are returned as 1-by-2 cell array consisting of 1-by-2 cell arrays.

```fname = "dddtf1"; df = dtfilters(fname)```
```df=1×2 cell array {1x2 cell} {1x2 cell} ```

Use `dddtree2` to obtain two wavelet decompositions of the image. Use the filter name for the first decomposition, and the filters for the second decomposition. Confirm the decompositions are equal.

```wtA = dddtree2("realdddt",x2,4,fname); wtB = dddtree2("realdddt",x2,4,df{1},df{2}); for k=1:length(wtA.cfs) t = max(abs(wtB.cfs{k}(:)-wtA.cfs{k}(:))) end```
```t = 0 ```
```t = 0 ```
```t = 0 ```
```t = 0 ```
```t = 0 ```

`"cplxdddt"` - Complex double-density dual-tree wavelet transform

The complex double-density dual-tree wavelet transform can be applied to 1-D and 2-D data. Valid filter names are:

• `"dddtf1"`

• `"self1"`

• `"self2"`

Use `dtfilters` to obtain the decomposition filters corresponding to `"self1"`. Confirm the filters are returned as 1-by-2 cell array consisting of 1-by-2 cell arrays.

```fname = "self1"; df = dtfilters(fname)```
```df=1×2 cell array {1x2 cell} {1x2 cell} ```

Use `dddtree` to obtain two wavelet decompositions of the 1-D signal. Use the filter name for the first decomposition, and the filters for the second decomposition. Confirm the decompositions are equal.

```wtA = dddtree("cplxdddt",x,4,fname); wtB = dddtree("cplxdddt",x,4,df{1},df{2}); for k=1:length(wtA.cfs) t = max(abs(wtB.cfs{k}(:)-wtA.cfs{k}(:))) end```
```t = 0 ```
```t = 0 ```
```t = 0 ```
```t = 0 ```
```t = 0 ```

## Input Arguments

collapse all

Filter name, specified as a character vector or string scalar. Valid entries for `name` are:

• Any valid orthogonal or biorthogonal wavelet name. See `wfilters` for details. An orthogonal or biorthogonal wavelet is only valid when the filter bank type is `"dwt"`, or when you use the filter as the first stage in a complex dual-tree transform, `"realdt"` or `"cplxdt"`.

Note

An orthogonal or biorthogonal wavelet filter is not a valid filter if you have a double-density, `"ddt"` or dual-tree double-density, `"realdddt"` or `"cplxdddt"`, filter bank. An orthogonal or biorthogonal wavelet filter is not a valid filter for complex dual-tree filter banks for stages greater than 1.

• `"dtfP"` — With P equal to 1, 2, 3, 4, or 5 returns the first-stage Farras filters (`"FSfarras"`) and Kingsbury Q-shift filters (`"qshiftN"`) for subsequent stages. This input is only valid for a dual-tree transform, `"realdt"` or `"cplxdt"`. Setting P = 1, 2, 3, 4, or 5 specifies the Kingsbury Q-shift filters with N = 6, 10, 14, 16, or 18 taps, respectively.

• `"dddtf1"` — Returns the filters for the first and subsequent stages of the double-density dual-tree transform. This input is only valid for the double-density dual-tree transforms, `"realdddt"` and `"cplxdddt"`.

• `"self1"` — Returns 10-tap filters for the double-density wavelet transform. This option is only valid for double-density wavelet transforms, `"realdddt"`, and `"cplxdddt"`.

• `"self2"` — Returns 16-tap filters for the double-density wavelet transform. This option is only valid for double-density wavelet transforms, `"realdddt"`, and `"cplxdddt"`.

• `"filters1"` — Returns 6-tap filters for the double-density wavelet transform, `"ddt"`.

• `"filters2"` — Returns 12-tap filters for the double-density wavelet transform, `"ddt"`.

• `"farras"` — Farras nearly symmetric filters for a two-channel perfect reconstruction filter bank. This option is meant to be used for one-tree transforms and is valid only for an orthogonal critically sampled wavelet transform, `"dwt"`. The output of `dtfilters` is a two-column matrix. The first column of the matrix is a scaling (lowpass) filter, and the second column is a wavelet (highpass) filter.

• `"FSfarras"` — Farras nearly symmetric first-stage filters intended for a dual-tree wavelet transform. With this option, the output of `dtfilters` is a cell array with two elements, one for each tree. Each element is a two-column matrix. The first column of the matrix is a scaling (lowpass) filter, and the second column is a wavelet (highpass) filter.

• `"qshiftN"` — Kingsbury Q-shift N-tap filters with N = 6, 10, 14, 16, or 18. The Kingsbury Q-shift filters are used most commonly in dual-tree wavelet transforms for stages greater than 1.

• `"doubledualfilt"` — Filters for one stage of the double-density dual-tree wavelet transforms, `"realdddt"` or `"cplxdddt"`. This option can also be used in the double-density wavelet transform, `"ddt"`.

This table can help you decide which filter to choose:

Type of Wavelet DecompositionValid Filters
`"dwt"` — Critically sampled (nonredundant) discrete wavelet transform (1-D and 2-D)
• Any valid orthogonal or biorthogonal wavelet name

• `"farras"`

`"ddt"` — Double-density wavelet transform (1-D and 2-D)
• `"filters1"`

• `"filters2"`

• `"doubledualfilt"`

• `"realdt"` — Real oriented dual-tree wavelet transform (2-D only)

• `"cplxdt"` — Complex oriented dual-tree wavelet transform (1-D and 2-D)

• Any valid orthogonal or biorthogonal wavelet name (only as first stage)

• `"dtfP"`

• `"FSfarras"` (only as first stage)

• `"qshiftN"` (only for stages > 1)

• `"realdddt"` — Real double-density dual-tree wavelet transform (2-D only)

• `"cplxdddt"` — Complex double-density dual-tree wavelet transform (1-D and 2-D)

• `"dddtf1"`

• `"self1"`

• `"self2"`

• `"doubledualfilt"` (for one stage of the double-density dual-tree wavelet transform)

## Output Arguments

collapse all

Decomposition (analysis) filters, returned as a matrix or cell array of matrices.

Reconstruction (synthesis) filters, returned as a matrix or cell array of matrices.

 Abdelnour, A. F., and I. W. Selesnick. “Design of 2-Band Orthogonal near-Symmetric CQF.” In 2001 IEEE International Conference on Acoustics, Speech, and Signal Processing. Proceedings (Cat. No.01CH37221), 6:3693–96. Salt Lake City, UT, USA: IEEE, 2001. https://doi.org/10.1109/ICASSP.2001.940644.

 Kingsbury, Nick. “Complex Wavelets for Shift Invariant Analysis and Filtering of Signals.” Applied and Computational Harmonic Analysis 10, no. 3 (May 2001): 234–53. https://doi.org/10.1006/acha.2000.0343.

 Selesnick, Ivan W., and A. Farras Abdelnour. “Symmetric Wavelet Tight Frames with Two Generators.” Applied and Computational Harmonic Analysis 17, no. 2 (September 2004): 211–25. https://doi.org/10.1016/j.acha.2004.05.003.

 Selesnick, I.W. “The Double-Density Dual-Tree DWT.” IEEE Transactions on Signal Processing 52, no. 5 (May 2004): 1304–14. https://doi.org/10.1109/TSP.2004.826174.