Added automatic grid detection to multi#911
Conversation
Can detect a grid from a binary mask without needing to specify top left coordinate, spacing, or radius Added automatic radius detection if a binary mask is passed. Added a way to calculate multiple rois from just an image and a mask, but won't have a grid layout. Refactored to break multi up into several helper functions
This is all added to the multi function. We want to split multi up into two functions, but I figure I'd commit this version just in case we want to reference back to it before I split it up into two functions
Also: changes the radius shrinking algorithm to not require a mask.
Also removed some redundancies and unnecessary code. Now img is an optional parameter for auto_grid, i.e. can be done with only a binary mask.
…grid removed bin_mask from multi- forces the user to specify a radius if only specifying a list of coord, radius is still optional for grid layout removed shapes parameter - removed rectangular grid functionality, will move to a separate UAV function Also added doc strings to multi and auto_grid and fixed bugs
added a freaking ,0 that finally fixed it
Codecov Report
@@ Coverage Diff @@
## 4.x #911 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 160 160
Lines 6714 6799 +85
=========================================
+ Hits 6714 6799 +85
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Co-authored-by: Jorge Gutierrez <[email protected]>
now an iterable, defaults to being a list of individual objects
…/plantcv into roi.multi_rerwite
…/plantcv into roi.multi_rerwite
nfahlgren
left a comment
There was a problem hiding this comment.
Attached code suggestions are mostly code formatting (linting) changes based on Python PEP8 guidelines.
The objects.md docs page should also document the class method append, and the code example could include an example of how to load saved objects.
The roi_multi.md docs page needs to be updated due to the change in the number of return items.
Minor thing, but I would recommend changing the filename test_Objects.py to test_objects.py based on our file naming convention (no uppercases).
Co-authored-by: Noah Fahlgren <[email protected]>
|
That should address the things you brought up in the review @nfahlgren |
plantcv/plantcv/roi/roi_methods.py
Outdated
| return roi_objects, overlap_img, all_roi_img | ||
|
|
||
|
|
||
| def auto_grid(bin_mask, nrows, ncols, radius=None, img=None): |
There was a problem hiding this comment.
I suggest we refactor the input keyword bin_mask. We use two standardized keywords elsewhere, bin_img or mask. Admittedly they pretty much mean the same thing (maybe there's sort of a connotation that mask is a clean binary image vs bin_img is not necessarily filtered yet)
Co-authored-by: Noah Fahlgren <[email protected]>
|
This is great @jdavidpeery! It's easy to use and the coding for it all was really well done |
Can detect a grid from a binary mask without needing to specify top left coordinate, spacing, or radius
Added automatic radius detection if a binary mask is passed.
Added a way to calculate multiple rois from just an image and a mask, but won't have a grid layout.
Refactored to break multi up into several helper functions
Describe your changes
A clear and concise description of what changes are made by this pull request.
What was the previous functionality (if relevant) and what can we do now with
these changes.
Type of update
Associated issues
#906
Additional context
Add any other context about the problem here.
For the reviewer
See this page for instructions on how to review the pull request.
plantcv/mkdocs.ymlupdating.md