Repository navigation
ENH: routine to estimate the noise standard deviation from an image - #1837
Conversation
|
I left |
|
Perhaps @arokem would be willing to help us review this one. He has dived deep into the landscape of noise estimation for neuroimaging in the past. |
|
Yeah, I can take a look. |
|
The error on Travis is due to the presence of the docstring example, but lack of PyWavelets so the doctest fails. Is there a simple way to tell the testing to skip it? |
|
The neuroimaging use case (at least for MRI) is a bit more complicated and would benefit from a more specialized solution. Often, one only has magnitude images which have Rician rather than Gaussian noise. Gaussian is a reasonable approximation when SNR is not too low, though. Also, for MRI, the noise standard deviation is often not spatially uniform so it is better to have localized estimates of sigma rather than a single value for the whole image/volume. |
|
Try |
|
Okay, the doctest is skipped now. It fails now because I listed PyWavelets in the |
There was a problem hiding this comment.
No references in first line of docstring.
|
Failing because of docstring formatting. |
|
Once we officially tag and release 0.12, we should seriously discuss adding PyWavelets as a required dependency for 0.13+. Then the docstring will pass, instead of needing to be skipped. |
|
Why don't you file an issue with 0.13 as the milestone, Josh?
|
|
The remaining failure (segfault!) on Python 2.6 does not seem related to this PR: |
There was a problem hiding this comment.
Is the call to asarray a standard thing in skimage, even when input is defined to be an array in the docstring?
|
Overall - looks good to me. Once the small comments are addressed, I think this is good to go. |
There was a problem hiding this comment.
Typo "Jain" should be "Iain".
|
Should I have tested with |
|
Also, should I add a conversion via |
|
@grlee77 Realistically, we aren't merging this before 0.12 is released. My thought process moving forward is to make PyWavelets a required dependency and open the floodgates to wavelet-based algorithms as major new features in 0.13. Further discussion on this in #1838. We're not talking a long time, here - work on 0.13dev should begin soon. For now, it would probably be cleanest (but not entirely satisfying) to continue with this PR assuming PyWavelets will be made a dependency in a separate PR. Ergo, drop the optional checks or raised errors/warnings in favor of assuming it'll be there. Yes, the tests will fail until after 0.12 is tagged and released. After that, a PR making PyWavelets a dependency can be merged and a simple rebase will bring this into the green. You can move forward with development/testing locally in virtualenvs. |
|
@blink1073 any idea about the segmentation fault of Travis? |
|
@emmanuelle, no idea, but it looks like it was unrelated to this PR and caused by matplotlib. I restarted the build to see if it is reproducible. |
|
Ah, as of 21 December, we're using matplotlib 1.5 in our builds. http://travis-wheels.scikit-image.org/. Matplotlib 1.5 does not support Python 2.6. We may have to follow suit for v0.12. @scikit-image/core, thoughts? |
|
@blink1073 do we need matplotlib 1.5 for the build? python 2.6 should be deprecated only after 0.12. |
|
We could pin to a lower version of matplotlib on our Travis build, and just rely on the fact that the user shouldn't be installing a newer version in they are on Py26. |
|
sounds good |
|
See #1841 |
|
@JDWarner: That all sounds good to me. I did not expect it to go in for 0.12. I can eventually rebase this to remove some of the unecessary commits adding and removing the optional dependency, etc. |
| References | ||
| ---------- | ||
| .. [1] D. L. Donoho and I. M. Johnstone. "Ideal spatial adaptation | ||
| by wavelet shrinkage." Biometrika 81.3 (1994): 425-455. |
There was a problem hiding this comment.
Could you add DOI:10.1093/biomet/81.3.425 please?
|
@grlee77 Thanks for pushing this :) very appreciated. I looked more carefully to your code. I think I found a possible bug and I raise few minor stuffs. Otherwise, it looks good. I'll look at it again once you fixed these little things. Thanks. |
|
Also, if you can incorporate this in the examples, that would be great! ;) |
…sian case is implemented
…hout multichannel=True
426baca to
63a09f5
Compare
|
LGTM, thanks @grlee77! |
|
Awesome! Thanks a lot @grlee77! |
This PR adds a routine for estimating the (Gaussian) noise standard deviation from an image. This should be of use with the various denoising routines in the usual case when the underlying noise standard deviation is unknown.
The algorithm implemented is based on the median absolute deviation of wavelet detail coefficients, so it requires
PyWaveletsto run.For example, this could be used by the method of #1833 to automate the threshold estimation.
A minimal example: