Skip to content
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

Adding new functionality/cleaning up skimage wrappers to ndi.morphology functions #2917

Open
wants to merge 43 commits into
base: main
Choose a base branch
from

Conversation

nrweir
Copy link
Contributor

@nrweir nrweir commented Dec 11, 2017

Description

This PR updates skimage.morphology.binary and skimage.morphology.grey morphology functions to utilize the new arguments available in the ndi.morphology functions they wrap, as per #2597.

Previously, skimage.morphology.binary and skimage.morphology.grey did not always directly utilize the ndi.morphology function equivalent (e.g. for skimage.morphology.binary.binary_closing, the function sequentially called the skimage.morphology.binary.binary_dilation followed by skimage.morphology.binary.binary_erosion (which are wrappers to ndi.morphology functions by the same names) rather than directly calling ndi.morphology.binary_closing. For clarity and simplicity, these functions were converted to direct wrappers for the ndi functions.

Docstrings have been edited to point out that these skimage.morphology functions are wrappers to the equivalent ndi.morphology functions.

Because of slight differences between how the skimage.morphology functions handled edges compared to the default mirroring implemented by most ndi.morphology functions, this required small changes to a couple of the tests:

  • skimage.morphology.grey.black_tophat tests had slightly different outputs as documented in the ENH: pass options from scipy.ndimage to our wrappers #2597 discussion. The expected test outputs were changed accordingly. Similarly,
  • skimage.morphology.grey.opening produced slightly different edge behavior when made into a cleaner wrapper for ndi.morphology.grey_opening.

These two changes were implemented by updating skimage/tests/gray_morph_output.npz.

One additional change was necessary to handle testing of eccentrically shaped strels in skimage.morphology.tests.test_grey.TestEccentricStructuringElements. The reasoning and change is documented there.

Checklist

[It's fine to submit PRs which are a work in progress! But before they are merged, all PRs should provide:]

Unit tests already existed for all of these functions, but tests don't currently exist to test the additional functionality generated by implementing the new arguments available to ndi.morphology functions. This is my next order of business.

References

#2597

For reviewers

(Don't remove the checklist below.)

  • Check that the PR title is short, concise, and will make sense 1 year
    later.
  • Check that new functions are imported in corresponding __init__.py.
  • Check that new features, API changes, and deprecations are mentioned in
    doc/release/release_dev.rst.

@pep8speaks
Copy link

pep8speaks commented Dec 11, 2017

Hello @nrweir! Thanks for updating the PR.

Cheers ! There are no PEP8 issues in this Pull Request. 🍻

Comment last updated on December 16, 2017 at 01:48 Hours UTC

@codecov-io
Copy link

codecov-io commented Dec 11, 2017

Codecov Report

Merging #2917 into master will decrease coverage by 0.02%.
The diff coverage is 89.61%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2917      +/-   ##
==========================================
- Coverage   86.04%   86.01%   -0.03%     
==========================================
  Files         337      337              
  Lines       27032    27052      +20     
==========================================
+ Hits        23259    23270      +11     
- Misses       3773     3782       +9
Impacted Files Coverage Δ
skimage/morphology/tests/test_binary.py 99.25% <100%> (+0.12%) ⬆️
skimage/morphology/binary.py 100% <100%> (ø) ⬆️
skimage/morphology/tests/test_grey.py 100% <100%> (ø) ⬆️
skimage/morphology/grey.py 86.04% <69.23%> (-9.79%) ⬇️
skimage/draw/_random_shapes.py 95.06% <0%> (-1.24%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e2a6094...c9f4300. Read the comment docs.

@nrweir
Copy link
Contributor Author

nrweir commented Dec 11, 2017

@soupault @stefanv @emmanuelle @jni looks like this passes the various build tests, let me know if you need more on my end.

@nrweir nrweir closed this Dec 14, 2017
adding new args to dilation and erosion

adding new args to white tophat, black tophat, opening, and closing

bugfix to black_tophat

testing to see if grey.py breaks the package

removing grey.py after it broke
@stefanv
Copy link
Member

stefanv commented Dec 14, 2017

@nrweir Any reason why you closed the PR?

@nrweir
Copy link
Contributor Author

nrweir commented Dec 14, 2017

@stefanv sorry, I wanted to clean up the messy commit history and add the new tests for the new arguments, and was going to generate a bunch of confusing commits in the process. I'll reopen shortly once I fix everything up. That ok?

@stefanv
Copy link
Member

stefanv commented Dec 14, 2017

OK, that's perfectly fine! In the future, you can also rename the PR with the "WIP: ..." prefix, and then keep pushing. We squash commits in the end anyway now, so having many is no problem. Thanks for working on this, Nicholas!

@nrweir
Copy link
Contributor Author

nrweir commented Dec 14, 2017 via email

@nrweir nrweir reopened this Dec 16, 2017
@nrweir
Copy link
Contributor Author

nrweir commented Dec 16, 2017

I'm having some issues with Travis builds where there's no obvious issue with my code (passes tests/etc.), but for some reason the build fails during flake8 testing. Couple of examples:

https://travis-ci.org/nrweir/scikit-image/jobs/317029332 where it throws an IOError
https://travis-ci.org/nrweir/scikit-image/jobs/317029334 where there's no error at all, it just cuts off in the middle of the flake8 test

Can someone help me figure out what's wrong? Thank you!!

@nrweir nrweir changed the title Adding new functionality/cleaning up skimage wrappers to ndi.morphology functions WIP: Adding new functionality/cleaning up skimage wrappers to ndi.morphology functions Dec 16, 2017
@nrweir nrweir changed the title WIP: Adding new functionality/cleaning up skimage wrappers to ndi.morphology functions Adding new functionality/cleaning up skimage wrappers to ndi.morphology functions Dec 16, 2017
@nrweir
Copy link
Contributor Author

nrweir commented Dec 17, 2017

(Seems like it only has these flake8 issues in my own Travis-CI, not in the scikit-image build test, so whatever...)

@soupault soupault added this to the 0.15 milestone May 23, 2018
@soupault soupault self-assigned this Jul 29, 2018
@soupault soupault modified the milestones: 0.15, 0.16 Apr 20, 2019
Base automatically changed from master to main February 18, 2021 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants