Skip to content

Morphology class - #2111

Merged
nfahlgren merged 14 commits into
v5.0from
morphology-class
Nov 19, 2026
Merged

nfahlgren merged 14 commits into
v5.0from
morphology-class

Conversation

@joshqsumner

@joshqsumner joshqsumner commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes
Deletes pcv.morphology.skeletonize and pcv.morphology.prune in favor of a new class pcv.morphology.morph that takes over those functions. Future PRs will add more features to morph but 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.

  • PR functionality reviewed in a Jupyter Notebook
  • All tests pass
  • Test coverage remains 100%
  • Documentation tested
  • New documentation pages added to plantcv/mkdocs.yml
  • Changes to function input/output signatures added to updating.md
  • Code reviewed
  • PR approved

@joshqsumner joshqsumner added this to the PlantCV v5.0 milestone Nov 2, 2026
@joshqsumner joshqsumner added the work in progress Mark work in progress label Nov 2, 2026
@deepsource-io

deepsource-io Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 1965709...bac010a on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

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.

@joshqsumner joshqsumner mentioned this pull request Nov 3, 2026
8 tasks done
@joshqsumner
joshqsumner added this pull request to stack #2134 November 6, 2026 15:39
@joshqsumner joshqsumner added ready to review and removed work in progress Mark work in progress labels Nov 9, 2026
@nfahlgren
nfahlgren requested a balanced review from Copilot November 13, 2026 02:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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
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

Comment thread docs/segment_insertion_angle.md Resolved

@nfahlgren nfahlgren left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Python classes are typically capitalized like Morph so that you can easily distinguish between the class itself and an instance morph

@joshqsumner
joshqsumner force-pushed the morphology-class branch 2 times, most recently from 7ab32ea to eb0b968 Compare November 13, 2026 15:38
@nfahlgren
nfahlgren force-pushed the morphology-class branch 3 times, most recently from 0348da1 to bac010a Compare November 18, 2026 20:42
@nfahlgren
nfahlgren merged commit d58c45c into v5.0 Nov 19, 2026
8 checks passed
@nfahlgren
nfahlgren deleted the morphology-class branch November 19, 2026 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants