Skip to content

Add 2D bit-identical test, prune_spurs/degenerate-object coverage - #34

Merged
annmoel merged 1 commit into
mainfrom
fix/crash-on-uniform-mask
Sep 4, 2026
Merged

Add 2D bit-identical test, prune_spurs/degenerate-object coverage#34
annmoel merged 1 commit into
mainfrom
fix/crash-on-uniform-mask

Conversation

@annmoel

@annmoel annmoel commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Fix a third crash, found while writing this coverage: a skeleton whose every connected component is a single isolated pixel (no edges anywhere - a legitimate Lee94 output for a tiny/noisy object) crashed skan's Skeleton() constructor with the same "index pointer size 0" error as the junction_cleanup case, but from build_vessel_graph itself, before junction_cleanup or prune_spurs ever run. Guarded the same way: degrade to an empty-features result instead of crashing. A mixed skeleton (a real branch plus a stray isolated pixel elsewhere) is unaffected - only an object whose entire skeleton is isolated points hits this.

Test additions:

  • tests/test_thin_2d.py: TestSkeletonizeComparison, the 2D analogue of test_3d_skimage_comparison.py - "2D output is bit-identical to scikit-image" previously had no test backing it at all.
  • tests/test_pipeline.py: TestPruneSpursIntegration (single spur removed end-to-end, multi-iteration pruning exposing a second spur, pruning everything away) and TestDegenerateObjects (a bbox touching every array edge, a single-pixel object, a mixed component) - config.extraction. prune_spurs and these edge cases had no pipeline-level coverage before.

Fix a third crash, found while writing this coverage: a skeleton whose
every connected component is a single isolated pixel (no edges anywhere -
a legitimate Lee94 output for a tiny/noisy object) crashed skan's
Skeleton() constructor with the same "index pointer size 0" error as the
junction_cleanup case, but from build_vessel_graph itself, before
junction_cleanup or prune_spurs ever run. Guarded the same way: degrade to
an empty-features result instead of crashing. A mixed skeleton (a real
branch plus a stray isolated pixel elsewhere) is unaffected - only an
object whose entire skeleton is isolated points hits this.

Test additions:
- tests/test_thin_2d.py: TestSkeletonizeComparison, the 2D analogue of
  test_3d_skimage_comparison.py - "2D output is bit-identical to
  scikit-image" previously had no test backing it at all.
- tests/test_pipeline.py: TestPruneSpursIntegration (single spur removed
  end-to-end, multi-iteration pruning exposing a second spur, pruning
  everything away) and TestDegenerateObjects (a bbox touching every array
  edge, a single-pixel object, a mixed component) - config.extraction.
  prune_spurs and these edge cases had no pipeline-level coverage before.
@annmoel
annmoel merged commit 38e813c into main Sep 4, 2026
1 check passed
@annmoel
annmoel deleted the fix/crash-on-uniform-mask branch September 4, 2026 12:30
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.

1 participant