Repository navigation
Morphology class - #2111
Morphology class#2111
Conversation
|
|
Overall Grade |
Security Reliability Complexity Hygiene Coverage |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| Python | Nov 18, 2026 8:42p.m. | Review ↗ | |
| Code coverage | Nov 18, 2026 8:49p.m. | Review ↗ |
Important
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved defects leave cached pruning data stale after skeleton replacement and cause debug visualization to crash on supported int32 labeled masks.
5 open issues
Invalidate cached skeleton data when replacing the skeleton · New Convert labeled masks to uint8 before debug visualization · New Point to methods that return a segmented image · New Update return documentation for the in-place method · New Restore exact-array and post-pruning contour regression tests · New
What changed in this PR
This PR begins the morphology restructuring in #2097 by replacing standalone skeletonization and pruning functions with pcv.morphology.morph, which stores the skeleton and automatically maintains leaf and stem segments.
Changes:
- Introduces the morphology class with pruning and optional repeated pruning.
- Extracts reusable segmentation helpers and replaces standalone-function tests with class tests.
- Updates API migration notes, documentation, and navigation.
| File | Description |
|---|---|
| tests/plantcv/morphology/test_skeletonize.py | Removes standalone skeletonization tests. |
| tests/plantcv/morphology/test_segment_sort.py | Adds debug-image output verification. |
| tests/plantcv/morphology/test_prune.py | Removes standalone pruning tests. |
| tests/plantcv/morphology/test_morph_class.py | Tests class initialization and pruning. |
| plantcv/plantcv/morphology/skeletonize.py | Removes the standalone skeletonization function. |
| plantcv/plantcv/morphology/segment_sort.py | Extracts sorting logic from debug rendering. |
| plantcv/plantcv/morphology/segment_skeleton.py | Extracts reusable skeleton segmentation logic. |
| plantcv/plantcv/morphology/prune.py | Removes the standalone pruning function. |
| plantcv/plantcv/morphology/morph_class.py | Adds morphology state and pruning methods. |
| plantcv/plantcv/morphology/__init__.py | Exports morph instead of removed functions. |
| mkdocs.yml | Links navigation to the class documentation. |
| docs/updating.md | Records the v5 API migration. |
| docs/skeletonize.md | Removes obsolete function documentation. |
| docs/segment_width.md | Points skeleton guidance to the class. |
| docs/segment_tangent_angle.md | Updates segment-source guidance. |
| docs/segment_sort.md | Updates skeleton and contour references. |
| docs/segment_skeleton.md | Updates skeleton guidance and removes obsolete pruning equivalence. |
| docs/segment_pathlength.md | Updates segment-source guidance. |
| docs/segment_insertion_angle.md | Revises skeleton and segmented-image guidance. |
| docs/segment_id.md | Updates skeleton and contour references. |
| docs/segment_euclidean_length.md | Updates segment-source guidance. |
| docs/segment_ends.md | Points skeleton guidance to the class. |
| docs/segment_curvature.md | Removes the standalone pruning reference. |
| docs/segment_combine.md | Updates segment-source guidance. |
| docs/prune.md | Removes obsolete function documentation. |
| docs/params.md | Removes the standalone pruning reference. |
| docs/morphology_class.md | Documents class attributes, pruning, and usage. |
| docs/find_tips.md | Points skeleton guidance to the class. |
| docs/find_branch_pts.md | Points skeleton guidance to the class. |
| docs/fill_segments.md | Updates segment-source guidance. |
Review effort: Balanced
nfahlgren
left a comment
There was a problem hiding this comment.
Python classes are typically capitalized like Morph so that you can easily distinguish between the class itself and an instance morph
7ab32ea to
eb0b968
Compare
a93fa42 to
8d4051b
Compare
8d4051b to
7cd68c0
Compare
7cd68c0 to
c395b19
Compare
0348da1 to
bac010a
Compare


Describe your changes
Deletes
pcv.morphology.skeletonizeandpcv.morphology.prunein favor of a new classpcv.morphology.morphthat takes over those functions. Future PRs will add more features tomorphbut in the interest of keeping the PR small(er) those are not implemented here.Type of update
This is refactoring/new feature.
Associated issues
Part of #2097
Additional context
None
For the reviewer
See this page for instructions on how to review the pull request.
plantcv/mkdocs.ymlupdating.md