scikit-image/scikit-image — pull request #760 by thearn (2013-10-06 21:16:28+00:00)
Title: Implemented wavelet filter

I've implemented a basic discrete wavelet transform filter for scikit-image.
At the moment, it's importing pywavelets directly, but it sounds like there will be a closer integration of source to come.

### The basics:
An n-level [discrete wavelet transform](http://en.wikipedia.org/wiki/Discrete_wavelet_transform) decomposes a digital image into 1 + 3*n coefficient matrices. The first is called the *approximation subband*, which captures the mean (and other low-frequency information) of the original image, and is essentially a down-sampled representation of it.

The remaining coefficient matrices are called the *detail subbands*. Thresholding functions are applied to these matrices. The wavelet transform is then reversed, to give the denoised result. Thresholding can either be [*soft* or *hard*](http://sfb649.wiwi.hu-berlin.de/fedc_homepage/xplore/tutorials/xlghtmlnode93.html).

The main variation between the wavelet denoising methods that are out there in the literature are in how the thresholding values for each detail subband is determined (whether it is uniform across all detail subbands, or individual for each, etc).

The function implemented here allows a user to specify the detail thresholds either uniformly, or by level, or by individual subband. This way, this function can be used to implement the majority of wavelet denoising methods out there (BayesShrink. SureShrink. etc) by writing short wrapping functions which pre-compute the thresholds accordingly.

I'll work on more thorough documentation / examples before moving to implement BayesShrink/VisuShrink/SureShrink. Couldn't hurt to have more tests either. If it desirable to have these things done before issuing a pull request, no problem. I will wait until I have it all together, if desired.

I also have some methods of my own that are pre-publication, but would be happy to include.

Usage is pretty simple. Arguments to `wavelet_filter` are the image to be denoised, threshold value(s), and all arguments which could be passed to `pywt.wavedec2`. Note that in `wavelet_filter`, the wavelet function to use is an optional arguement, and defaults to `haar`.
```python
from skimage.filters import wavelet_filter
from scipy.misc import lena
A = lena()
# 1-level db4 transform, soft threshold all detail subbands at t=10.
B = wavelet_filter(A, 10., wavelet="db4")
# 3-level Haar transform, hard threshold each level with its own value
t = [10., 8., 3.]
B = wavelet_filter(A, t, thresh_type="hard", level=3)
# 2-level sym14 transform, with each subband getting its own threshold
t = [[10., 80., 30.], [80., 17., 19.]]
B = wavelet_filter(A, t, wavelet="sym14", level=2)
```

[Here](http://i.imgur.com/69ac1Bh.png) are results for
```python
wavelet_filter(A, 25., wavelet="sym14", level=10)
```
Artifacts can be reduced by finer tuning of the thresholds, and careful selection of the wavelet function.