Skip to content

Commit

Permalink
Update napari_label_classes.md
Browse files Browse the repository at this point in the history
  • Loading branch information
HaleySchuhl committed Sep 12, 2024
1 parent 2398d13 commit 8dd136b
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions docs/napari_label_classes.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
## Label Image with Napari

This function opens an image in Napari and then defines a set of classes to label. A random shape label is assigned to each class.
This function opens an image in Napari and then defines a set of Points layers with the user-defined labels called `classes`. A random `shape` of the annotation symbol is assigned to each of the `classes`.
Image can be annotated as long as viewer is open.

**plantcv.annotate.napari_label_classes*(*img, classes, size, shape =10, 'square', importdata=False, show=True*)
**plantcv.annotate.napari_label_classes*(*img, classes, size=10, shape='square', importdata=False, show=True*)

**returns** napari viewer object

- **Parameters:**
- img - image data (compatible with gray, RGB, and hyperspectral data. If data is hyperspecral it should be the array e.g. hyperspectral.array_data)
- classes - list of classes to label. This option is not necessary if data is data is imported.
- size - integer pixel size of label
- shape - can be 'o', 'arrow', 'clobber', 'cross', 'diamond', 'disc', 'hbar', 'ring', 'square', 'star', 'tailed_arrow',
'triangle_down', 'triangle_up', 'vbar', 'x'.
- size - integer pixel size of label (also adjustable from the interactive Napari viewer)
- shape - shape of the annotation symbol. Can be 'o', 'arrow', 'clobber', 'cross', 'diamond', 'disc', 'hbar', 'ring', 'square' (default), 'star', 'tailed_arrow',
'triangle_down', 'triangle_up', 'vbar', or 'x' (also adjustable from the interactive Napari viewer)
- importdata - dictionary of data, data saved from napari_save_coor or data imported from napari_read_coor
- show - if show = True, viewer is launched. False setting is useful for test purposes.
- show - if `show=True`, viewer is launched. `False` setting is useful for test purposes.

- **Context:**
- Adding class labels to images. Works best on an image that has objects segmented/classified with contours/clusters labeled with values (e.g. labeled mask, output of kmeans clustering).
- Adding one or more classes of points layer for annotation of the image.

- **Example use:**
- Labeling output of kmeans clustering into classes. Labeling points.
- Ground truth counting, labeling classes of objects of interest.


```python
Expand All @@ -31,9 +31,8 @@ import napari
# Create an instance of the Points class
img, path, name = pcv.readimage("./grayimg.png")

viewer = pcvan.napari_label_classes(img=img, classes=['background', 'wing','seed'], size = 30)

# Should open interactive napari viewer
# Opens interactive napari viewer
viewer = pcvan.napari_label_classes(img=img, classes=['background', 'wing','seed'], size=30)

```

Expand Down

0 comments on commit 8dd136b

Please sign in to comment.