scikit-image/scikit-image — pull request #772 by JDWarner (2013-10-11 07:13:11+00:00)
Title: FIX: Fix and improve Poisson random noise generator

The Poissson generator now works. This should resolve recent comments on merged #625

The Poisson generator is also considerably improved. It infers the bit depth of the image *after* conversion to a floating point image, by analyzing the unique values present and finding the next power of two. This value is then used to scale the floating point image up, after which Poisson noise is generated, and finally the image is scaled back down.

In my opinion this is an improvement over Matlab's approach, which is rather erratic based on what you feed it.

**Do not merge before the below question is answered!**

Unfortunately, the Poisson distribution can result in overflows. These are gracefully handled and not aliased in the current implementation, consider:

``` python
import numpy as np
from skimage.data import camera
data = camera() # 512x512 grayscale uint8
cam_noisy = random_noise(data, mode='poisson', seed=42)
print cam_noisy.max()
```
The result should be 1.152. The question is what to do in this case. I see two options.

* Clip the result back to the proper [0, 1] range
* Rescale the image to [0, 1], preserving the noisy overflows but potentially lowering overall brightness slightly

I'm conflicted on which is the superior path, so advice appreciated! With consensus either way, I'll implement and then it should be merge-ready.