-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New function: skimage.filters.try_all_threshold_dict (counterpart to try_all_threshold) #3207
base: main
Are you sure you want to change the base?
New function: skimage.filters.try_all_threshold_dict (counterpart to try_all_threshold) #3207
Conversation
…discussed in issue 2178 and 3149)
…into try-all-thresh-dict
Hello @GenevieveBuckley! Thanks for submitting the PR.
|
@@ -134,6 +135,59 @@ def wrapper(im): | |||
methods=methods, verbose=verbose) | |||
|
|||
|
|||
def try_all_threshold_dict(image): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't find this name particularly elegant. Ideally, I would prefer try_all_threshold
-> dict and try_all_threshold_plotted
-> mpl. But this would require a deprecation cycle...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed; have try_all_threshold
always return results, and then add a visualize
flag?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stefanv that makes it harder/impossible to return the figure and axes as done currently. At any rate, if long term we want to remove the mpl dependency for analysis, we could have try_all_threshold
return a dict, and then have a separate function in e.g. the viewer (or whatever we call the skimage-mpl package) to visualise that dictionary.
Either way, yes, a deprecation is going to be needed. =\
>>> dict = try_all_threshold_dict(text()) | ||
""" | ||
# Global algorithms. | ||
methods = OrderedDict({'Isodata': threshold_isodata, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would make sense to me to do not duplicate this list in the code in order to make the addition of algorithms more straightfoward.
I made 2 comments, but it's open for discussion. |
I like that suggestion--calculation wrapped by plotting in a separate function.
|
Hey all, |
Description
A new function
skimage.filters.try_all_threshold_dict
is implemented.An ordered dictionary is returned from
skimage.filters.try_all_threshold_dict
(keys = threshold method names, values = numeric value or None), whereas its counterpartskimage.filters.try_all_threshold
returns a matplotlib visualisation.This is implemented as a separate function to
skimage.filters.try_all_threshold
for the reasons @jni outlines here:Checklist
[It's fine to submit PRs which are a work in progress! But before they are merged, all PRs should provide:]
./doc/examples
(new features only)./benchmarks
, if your changes aren't covered by anexisting benchmark
[For detailed information on these and other aspects see scikit-image contribution guidelines]
References
First suggested by @stefanv in 2178, and requested by @emmanuelle in 3149.
For reviewers
(Don't remove the checklist below.)
later.
__init__.py
.doc/release/release_dev.rst
.@meeseeksdev backport to v0.14.x