Add hand-crafted synthetic patterns to the scikit-image equivalence tests - #42
Merged
Merged
Conversation
…ests Complements TestSkeletonizeComparison's single real photo (data.horse()/ data.brain()) with small, deliberately-constructed patterns that each target a specific edge case from the Euler-invariant-redundancy proof rather than relying on whatever topology happens to occur in a real image: a ring/hollow-shell (one hole/cavity to preserve, Lemma 1), two holes separated by a single-pixel bridge (the opposite-face-neighbors configuration behind Lemma 2), a diagonal line and a space-diagonal line (the 8-vs-4 / 26-vs-6 connectivity paradox the border-point discussion is built on), T/X-junctions and a 3D plus-junction (branch points), and a solid blob smaller than its canvas. Deliberately excluded: a volume exactly 1 voxel thick along one axis. Investigated this directly - scikit-image's shared 3D routine special-cases that shape (dropping to 4 border directions, treating it as an embedded 2D image), which thin_3d does not since real 3D data is never expected to be flat across its entire extent. Confirmed by restricting thin_3d's own candidate/removal functions to those same 4 directions: doing so reproduces scikit-image's output exactly, so this is a real, understood difference in scope rather than a bug - not one thin_3d was designed to match, and documented as such in the new test class's docstring. All 14 new cases pass (9 in 2D, 5 in 3D); full file-scoped suite still green (39 passed).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Complements
TestSkeletonizeComparison's single real photo (data.horse()/data.brain()) with small, deliberately-constructed patterns that each target a specific edge case from the Euler-invariant-redundancy proof in the paper's appendix, rather than relying on whatever topology happens to occur in a real image:tests/test_thin_2d.py,TestSyntheticPatternEquivalence): isolated pixel, straight line, diagonal line, the minimal 2x2 checkerboard corner (the 8-vs-4-connectivity paradox), T-junction, X-junction, a ring with one real hole (Lemma 1: impossibility of hole creation), two holes separated by a single-pixel bridge (the opposite-face-neighbors configuration behind Lemma 2: impossibility of hole elimination), and a solid blob smaller than its canvas.tests/test_thin_3d.py,TestSyntheticPatternEquivalence): isolated voxel, axis-aligned line, space-diagonal line (26-vs-6 connectivity analogue), a degree-6 plus-junction, and a hollow shell with one real cavity.All 14 cases assert exact
np.array_equalagreement withskimage.morphology.skeletonize(..., method="lee")- agreement only, no independent topology-invariant assertion, as discussed.