-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add segment_ends
and Update morphology tips outputs
#1644
Open
HaleySchuhl
wants to merge
38
commits into
main
Choose a base branch
from
update_morphology_tips_outputs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
ac60d30
Create segment_ends.py
HaleySchuhl a5ef615
range rather than enumerate
HaleySchuhl 269137a
helper for _find_tips
HaleySchuhl cf17f11
update more instances of find_tips to use helper
HaleySchuhl 034ebac
remove label from helper function
HaleySchuhl d0f49b2
Update __init__.py
HaleySchuhl 0ea3128
add label logic into the front facing function
HaleySchuhl 66f25fb
update segment sort stop editing tip info
HaleySchuhl 7558e8c
add segment_ends to morphology init
HaleySchuhl acffd97
add segment_img as required input, add outputs
HaleySchuhl 43cfbdb
Create test_segment_ends.py
HaleySchuhl 81d0574
update segment_id allow optimal_assignment of IDs
HaleySchuhl 4c48eac
Update test_segment_id.py
HaleySchuhl eddfab5
convert to color for debug image
HaleySchuhl 49bdc78
segment_ends check tip or branch_pt
HaleySchuhl 5753678
test_segment_ends_no_mask
HaleySchuhl fc6074d
segment_sort no need to store label
HaleySchuhl be3cdb7
Re-defined variable from outer scope
HaleySchuhl 86db239
remove unused var
HaleySchuhl 9e84adc
white space fixes
HaleySchuhl dcea2a9
line length fixes
HaleySchuhl 333e353
remove trailing whitespace
HaleySchuhl ee3e4be
more whitespaces fixes
HaleySchuhl 0b63217
move _iterative_prune and _find_tips to _helpers
HaleySchuhl 554b499
whitespace fixes
HaleySchuhl f802504
move segment_end sorting logic into _helpers
HaleySchuhl d8fd5c0
add logic for returning the optimal segment assignment
HaleySchuhl 0b296b1
updating.md add segment_ends
HaleySchuhl 6fde9cd
Create segment_ends.md
HaleySchuhl a8c74a5
whitespace deepsource fixes
HaleySchuhl 85c2c9f
add debug images for segment ends
HaleySchuhl 869c232
return sorted objs instead of ordered labels
HaleySchuhl 2e4149d
Update mkdocs.yml
HaleySchuhl fa7f689
update docs to reflect new sorting approach
HaleySchuhl 2b8480a
update segment_ends sorting logic
HaleySchuhl a3d0cff
minor tweaks to docs for clarity and accuracy
HaleySchuhl bd17ad8
Merge branch 'main' into update_morphology_tips_outputs
HaleySchuhl a38e353
Merge branch 'main' into update_morphology_tips_outputs
k034b363 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
## Identify Segment Ends | ||
|
||
Find segment tip and inner branch-point coordinates, and sort them by the y-coordinates of the branch points | ||
|
||
**plantcv.morphology.segment_ends**(*skel_img, leaf_objects, mask=None, label=None*) | ||
|
||
**returns** Re-ordered leaf segments | ||
|
||
- **Parameters:** | ||
- skel_img - Skeleton image (output from [plantcv.morphology.skeletonize](skeletonize.md)) | ||
- leaf_objects - Secondary segment objects (output from [plantcv.morphology.segment_sort](segment_sort.md)). | ||
- mask - Binary mask for plotting. If provided, the debugging image will be overlaid on the mask (optional). | ||
- label - Optional label parameter, modifies the variable name of observations recorded. (default = `pcv.params.sample_label`) | ||
- **Context:** | ||
- Aims to sort leaf objects by biological age. This tends to work somewhat consistently for grass species that have leav | ||
|
||
**Reference Images** | ||
|
||
 | ||
|
||
```python | ||
|
||
from plantcv import plantcv as pcv | ||
|
||
# Set global debug behavior to None (default), "print" (to file), | ||
# or "plot" (Jupyter Notebooks or X11) | ||
pcv.params.debug = "plot" | ||
|
||
# Adjust point thickness with the global line_thickness parameter (default = 5) | ||
pcv.params.line_thickness = 3 | ||
|
||
sorted_obs = pcv.morphology.segment_ends(skel_img=skeleton, | ||
leaf_objects=leaf_objs, | ||
mask=plant_mask, | ||
label="leaves") | ||
|
||
segmented_img, leaves_labeled = pcv.morphology.segment_id(skel_img=skeleton, | ||
objects=leaf_objs, | ||
mask=plant_mask | ||
# Without ID re-assignment | ||
segmented_img, leaves_labeled = pcv.morphology.segment_id(skel_img=skeleton, | ||
objects=sorted_obs, | ||
mask=plant_mask) | ||
|
||
``` | ||
|
||
*Segment end points Debug* | ||
|
||
 | ||
|
||
**Source Code:** [Here](https://github.com/danforthcenter/plantcv/blob/main/plantcv/plantcv/morphology/segment_ends.py) |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the context is incomplete, just needs the end of that sentence about grass species.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, in the example usage there is a parenthesis missing, and I think the two segment_id examples are reversed? Should the "without id reassignment" example be with leaf_objs, not sorted_obs?