Interactive Point Annotation Tool¶
Using Jupyter Notebooks it is possible to interactively click to collect coordinates from an image, which can be used in various downstream applications. Left click on the image to collect a point. Right click removes the closest collected point.
plantcv.annotate.Points(img, figsize=(12,6), label="dafault")
returns interactive image class
-
Parameters:
- img - Image data
- figsize - Interactive plot figure size (default = (12,6))
- label - The current label (default = "default")
-
Attributes:
- coords - dictionary of all coordinates per group label
- events - includes right and left click events
- count - dictionary that save the counts of different groups (labels)
- label - the current label
- sample_labels - list of all sample labels, one to one with coordinates collected
- view_all - flag indicating whether or not to view all labels
- color - current color
- colors - all used colors
- figsize - size of the interactive plotting figure
-
Context:
- Used to define a list of coordinates of interest.¶
- Example use:
- (pcv.roi.multi)
- (pcv.roi.custom)
import plantcv.plantcv as pcv
import plantcv.annotate as an
# Create an instance of the Points class
marker = an.Points(img=img, figsize=(12,6))
# Click on the plotted image to collect coordinates
# Use the identified coordinates to create a custom polygon ROI
roi = pcv.roi.custom(img=img, vertices=marker.coords['default'])
Source Code: Here