Skip to content

morphology.segment_skeleton returned segment_objects to list#1720

Merged
nfahlgren merged 2 commits into
mainfrom
morphology-segments-to-list
Jun 24, 2025
Merged

morphology.segment_skeleton returned segment_objects to list#1720
nfahlgren merged 2 commits into
mainfrom
morphology-segments-to-list

Conversation

@HaleySchuhl

@HaleySchuhl HaleySchuhl commented Jun 17, 2025

Copy link
Copy Markdown
Contributor

Describe your changes
The segment_objects returned by pcv.morphology.segment_skeleton is supposed to be a list of OpenCV contours. This change casts the tuple type list of objects into a proper list type object.

Type of update
Is this a:

  • Bug fix

Associated issues

Additional context
It appears that something upstream changed within cv2.findContours which formats the contours inside a tuple. This causes an error downstream within the pcv.morphology.fill_segments analysis function, since tuple type objects are not supported with the operation .copy() which the function does to preserve the input list of objects/contours.

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

@HaleySchuhl HaleySchuhl added this to the PlantCV v4.8 milestone Jun 17, 2025
@HaleySchuhl HaleySchuhl self-assigned this Jun 17, 2025
@HaleySchuhl HaleySchuhl added bugfix Bug fixes update Updates an existing feature/method labels Jun 17, 2025
@github-project-automation github-project-automation Bot moved this to Pull Requests in PlantCV4 Jun 17, 2025
@deepsource-io

deepsource-io Bot commented Jun 17, 2025

Copy link
Copy Markdown

Here's the code health analysis summary for commits 598a347..8623f95. View details on DeepSource ↗.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource Python LogoPython✅ SuccessView Check ↗
DeepSource Test coverage LogoTest coverage✅ SuccessView Check ↗

Code Coverage Report

MetricAggregatePython
Branch Coverage100%100%
Composite Coverage100%100%
Line Coverage100%100%
New Branch Coverage100%100%
New Composite Coverage100%100%
New Line Coverage100%, ✅ Above Threshold100%, ✅ Above Threshold

💡 If you’re a repository administrator, you can configure the quality gates from the settings.

@k034b363 k034b363 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Using a different image and my own code, I can replicate the error described by the issue that prompted this change. The modification made in this PR fixes it and allows for downstream use of the objects from segment_skeleton.

@nfahlgren nfahlgren merged commit 034bbea into main Jun 24, 2025
5 checks passed
@github-project-automation github-project-automation Bot moved this from Pull Requests to Done in PlantCV4 Jun 24, 2025
@nfahlgren nfahlgren deleted the morphology-segments-to-list branch June 24, 2025 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Bug fixes ready to review update Updates an existing feature/method

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

fill segments --> fill_segments.py --> line 38

3 participants