Deprecate old threshold_adaptive API#2490
Conversation
Codecov Report@@ Coverage Diff @@
## master #2490 +/- ##
==========================================
+ Coverage 90.69% 90.69% +<.01%
==========================================
Files 304 304
Lines 21527 21542 +15
Branches 1859 1860 +1
==========================================
+ Hits 19523 19538 +15
Misses 1661 1661
Partials 343 343
Continue to review full report at Codecov.
|
sciunto
left a comment
There was a problem hiding this comment.
I left a minor remark. Great PR.
skimage/filters/thresholding.py
Outdated
| def threshold_adaptive(image, block_size, method='gaussian', offset=0, | ||
| mode='reflect', param=None): | ||
| warn('The return value of `threshold_local` is not the same as that ' | ||
| 'of `threshold_adaptive`.') |
There was a problem hiding this comment.
Perhaps we can be more precise here by saying that threshold_adaptive returns a thresholded image while threshold_local return the threshold values.
|
@sciunto good suggestion, done! I hope... =) |
| def threshold_adaptive(image, block_size, method='gaussian', offset=0, | ||
| mode='reflect', param=None): | ||
| warn('The return value of `threshold_local` is a threshold image, while ' | ||
| '`threshold_adaptive` returned the *thresholded* image.') |
There was a problem hiding this comment.
Please, add also a warning saying that the function is deprecated and will be removed in 0.15.
There was a problem hiding this comment.
The decorator miust do it... but not the version, you're right
There was a problem hiding this comment.
Hmm... Perhaps, we could add a version argument to the deprecated class 🤔 .
|
This should be ready now! |
|
Such a good PR! Thanks @jni ! |
Description
This PR makes all thresholding functions consistent by returning (by default) a value
thresholdthat can be used to threshold the original image withthresholded = image > threshold. The value may be a scalar or an array with the same shape as the input image.See discussion in #2121 for alternate APIs. However, this API is consistent with the current API for almost all our thresholding functions, so I think it should be strongly preferred, and it should certainly be preferred for the purposes of the 0.13 release.
Checklist
./doc/examples(new features only)References
Closes #2121