plantcv icon indicating copy to clipboard operation
plantcv copied to clipboard

Interactive object count

Open JorgeGtz opened this issue 3 years ago • 6 comments

Describe your changes Added the function detect_discs which helps detecting the pollen grains in the image in #746. This branch is intended to be updated with the interactive tool for counting objects in an image. Added the function get_centroids that returns the coordinates of the connected regions in a binary image. The coordinates can be used in the interactive tool to automatically count the objects given by the binary image.

Type of update Is this a:

  • New feature or feature enhancement
  • Work in progress

Associated issues Associated with #746

Additional context The goal is to provide an interactive tool for object counting that can be used with other PlantCV functions to semi-automate the counting.

JorgeGtz avatar Apr 14 '21 16:04 JorgeGtz

Codecov Report

Attention: 275 lines in your changes are missing coverage. Please review.

Comparison is base (7c7b4ec) 100.00% compared to head (7d79c18) 96.27%. Report is 2 commits behind head on interactive-tools.

:exclamation: Current head 7d79c18 differs from pull request most recent head 9137049. Consider uploading reports for the commit 9137049 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@                  Coverage Diff                  @@
##           interactive-tools     #754      +/-   ##
=====================================================
- Coverage             100.00%   96.27%   -3.73%     
=====================================================
  Files                    158      160       +2     
  Lines                   6944     7389     +445     
=====================================================
+ Hits                    6944     7114     +170     
- Misses                     0      275     +275     
Flag Coverage Δ
unittests 96.27% <50.98%> (-3.73%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
plantcv/plantcv/__init__.py 100.00% <ø> (ø)
plantcv/plantcv/annotate/__init__.py 100.00% <100.00%> (ø)
plantcv/plantcv/annotate/classes.py 100.00% <100.00%> (ø)
plantcv/plantcv/annotate/detect_discs.py 100.00% <100.00%> (ø)
plantcv/plantcv/annotate/get_centroids.py 100.00% <100.00%> (ø)
plantcv/plantcv/classes.py 100.00% <100.00%> (ø)
plantcv/plantcv/visualize/__init__.py 100.00% <ø> (ø)
plantcv/plantcv/watershed.py 100.00% <100.00%> (ø)
plantcv/plantcv/annotate/temp_file.py 0.00% <0.00%> (ø)

... and 23 files with indirect coverage changes

codecov[bot] avatar Apr 14 '21 16:04 codecov[bot]

I started reviewing/testing this PR and ran into a few questions:

  • Is get_centroids redundant since detect_discs is returning coordinates? When the threshold is set to the upper bound of 1, then I think the latter is already performing the functionality of gathering centroids. I also think these data should get stored to output observations.
  • Should we consider updating the format that data gets saved out to be more consistent with other output observations? It seems safe to assume that these tools would be used just on one image at a time since it's a user-in-the-loop type of workflow, but right now the json data getting stored out doesn't have the other standard metadata that we include with plantcv outputs.

Updates I plan to make:

  • round coordinates stored by the decect_disks function to be integers
  • write a static tutorial that goes from raw image, includes detect_disks and ClickCount, and eventually add it to the tutorial gallery and binder tutorials.
  • resolve conflicts

HaleySchuhl avatar Sep 15 '21 17:09 HaleySchuhl

The branch has been fully updated with the 4.x branch, so ready to review/work on again

nfahlgren avatar May 02 '23 16:05 nfahlgren

I can start testing this out after lunch! Can you slack me the test notebook and image you have or is it already on the datasci shared drive?

HaleySchuhl avatar May 02 '23 16:05 HaleySchuhl

I only did code updates to fix the conflicts and refactor the tests into modules. Looks like you might have been testing it before, but you might not have gotten to the notebook stage yet? And/or @JorgeGtz might have somthing.

I think we were also discussing merging in the Points functionality?

nfahlgren avatar May 02 '23 16:05 nfahlgren

I have a stomata notebook after all. Added this function to the agenda for discussion at dev meeting tomorrow :)

HaleySchuhl avatar May 03 '23 15:05 HaleySchuhl