Skip to content

Commit

Permalink
Updating videos (with no audio)
Browse files Browse the repository at this point in the history
  • Loading branch information
melissawm committed Dec 27, 2023
1 parent 81f6820 commit d76fb5c
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 64 deletions.
136 changes: 72 additions & 64 deletions docs/howtos/layers/labels.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ layer:
* shuffle colors
* label eraser
* paintbrush
* polygon tool
* fill bucket
* color picker
* pan/zoom mode
Expand Down Expand Up @@ -72,15 +73,16 @@ layer:
* **Label eraser**

Use this tool to manually erase a label on the `labels layer`. Other layers
will not be affected. It looks like this: ![image: eraser tool](../../images/labels-layer-eraser.png)
will not be affected. The label eraser tool looks like this:
![image: eraser tool](../../images/labels-layer-eraser.png)

* **Paintbrush**

One of the major use cases for the `labels layer` is to manually edit or
create image segmentations. One of the tools that can be used for manual
editing is the `paintbrush`, activated by clicking the `paintbrush` icon in
the `layer controls` panel. Once the paintbrush is enabled, the pan and zoom
functionality of the viewer canvas is disabled, and you can paint on the
functionality of the viewer canvas is disabled, and you can paint on the
canvas. You can temporarily re-enable pan and zoom by pressing and holding the
spacebar. This feature is useful if you want to move around the `labels layer`
as you paint.
Expand All @@ -93,8 +95,8 @@ layer:
`fill bucket` tool. It can be the same color as the edge or a different color.

Adjust the size of your `paintbrush` using the `brush size` slider or using
the default keybindings: `[` and `]`. It can be
as small as a single pixel for incredibly detailed painting.
the default keybindings: `[` and `]`. The brush size can be as small as a
single pixel for incredibly detailed painting.

If you have a multidimensional `labels layer` then your `paintbrush` will edit
data only in the visible slice by default. If you enable the `n_dimensional`
Expand All @@ -104,33 +106,6 @@ layer:
To quickly select the paintbrush, press the `2` key when the `labels layer` is
selected.

* **Fill bucket**

Sometimes you might want to replace an entire label with a different label.
This could be because you want to make two touching regions have the same
label, or you want to replace only one label with a different one, or maybe
you have painted around the edge of a region and you want to quickly fill in
its inside. To do this you can select the `fill bucket` by clicking on the
eye-dropper icon in the `layer controls` panel and then click on a target
region of interest in the layer. The fill bucket will fill using the currently
selected label. If nothing is selected the entire layer will be filled with
that label.

By default, the `fill bucket` will change only contiguous or connected pixels
of the same label as the pixel that is clicked on. If you want to change all
the pixels of that label layer regardless of where they are in the slice, then
you can set the `contiguous` property or checkbox to `False`. Then everything
on that layer will be colored by the new label.

If you have a multidimensional `labels layer` the `fill bucket` will edit data
only in the visible slice by default. Enable the `n_dimensional` property and
`paintbrush` so the `fill bucket` will extend out into neighbouring slices,
either to all pixels with that label in the layer, or only connected pixels
depending on if the contiguous property is disabled or not.

To quickly select the fill bucket, press the `3` key when the `labels layer`
is selected.

* **Polygon**

Another tool that can be used to quickly add or edit image segmentations is
Expand All @@ -150,8 +125,8 @@ layer:
6. To cancel the drawing at any time without making a permanent change on the
labels layer, press `Esc`. This will delete the polygon overlay.
7. Press `Enter` to finish drawing at any time or double click within a radius
of 20 screen pixels of the first vertex. This will add the polygon overlay
to the labels layer.
of 20 screen pixels of the first vertex. This will add the polygon overlay
to the labels layer.

The polygon overlay will have the color of the label. The polygon overlay also
has an opacity that can be adjusted the value of the `opacity` slider in the
Expand All @@ -168,24 +143,52 @@ layer:
toggling the number of displayed dimensions, the `polygon` tool will be
automatically deactivated.

* **Fill bucket**

Sometimes you might want to replace an entire label with a different label.
This could be because you want to make two touching regions have the same
label, or you want to replace only one label with a different one, or maybe
you have painted around the edge of a region and you want to quickly fill in
its inside. To do this you can select the `fill bucket` tool by clicking on
its icon in the `layer controls` panel, and then click on a target region of interest in the layer. The fill bucket will fill using the currently selected
label. If nothing is selected the entire layer will be filled with that label.

By default, the `fill bucket` will change only contiguous or connected pixels
of the same label as the pixel that is clicked on. If you want to change all
the pixels of that label layer regardless of where they are in the slice, then
you can set the `contiguous` property or checkbox to `False`. Then everything
on that layer will be colored by the new label.

If you have a multidimensional `labels layer` the `fill bucket` will edit data
only in the visible slice by default. Enable the `n_dimensional` property and
`paintbrush` so the `fill bucket` will extend out into neighbouring slices,
either to all pixels with that label in the layer, or only connected pixels
depending on if the contiguous property is disabled or not.

To quickly select the fill bucket, press the `4` key when the `labels layer`
is selected.

* **Color picker**

The `color picker` can be used to select another color at any time. Click the
color picker tool then click on the color in the label pallette you would like
to use. That color now appears on the label bar as the selected color. If the
color does not exist in the label color pallette, it defaults to 0 and a
checkerboard pattern appears in the thumbnail on the label bar to represent
the transparent color.
color picker tool then click on the existing color in the labels layer you
would like to use. That color now appears on the label bar as the selected
color. If the color does not exist in the label color pallette, it defaults
to 0 and a checkerboard pattern appears in the thumbnail on the label bar to
represent the transparent color.

**Note:** The color of the label can be selected by clikcing on the + or -
To quickly select the color picker, press the `5` key when the `labels layer`
is selected.

**Note:** The color of the label can be selected by clicking on the + or -
symbols at either end of the bar or by clicking on the number in the center of
the bar and typing in the number of the color to use. 255 colors are available.

### Controls

* Label

Use this combobox to choose a color for a label you are about to create or to
Use this control to choose a color for a label you are about to create or to
change the color of an existing label.

* Opacity
Expand All @@ -208,44 +211,48 @@ layer:

Select `auto` or `direct` from the dropdown. Auto is the default and allows
color to be set via a hash function with a seed. Direct allows the color of
each label to be set directly by a color dictionary.
each label to be set directly by a color dictionary, which can be accessed
directly via the `color` property of the layer, `layer.color`.

* Contour

If this combo box has any value other than 0, only the contours of the labels
If this field has any value other than 0, only the contours of the labels
will show. Change the value by clicking the - or + symbols on either end of
the bar.
the bar, or by clicking the number in the center of the bar and typing in the
desired value.

* n edit dim

This is the number of dimensions across which labels will be edited.

* Contiguous

If this box is checked the `fill bucket` changes only connected pixels of the
If this box is checked, the `fill bucket` changes only connected pixels of the
same label.

* Preserve labels

If this box is checked, existing labels are preserved while painting. It
defaults to false to allow painting on existing labels. When set to true,
existing labels will be preserved during painting. You can toggle
this mode using the default keybinding `p`.
existing labels will be preserved during painting.

**You can toggle this mode using the default keybinding `p`.** DOESN'T WORK

* Show selected

When this is checked only the selected labels will be displayed. Selected
labels are those labels that match the color in the `label` combo box. When it
When this is checked, only the selected labels will be displayed. Selected
labels are those labels that match the color in the `label` control. When it
is not checked, all labels will be displayed.

## Editing using the tools in the GUI

### Pan and zoom mode

The default mode of the `labels layer` is to support panning and zooming. This
mode is represented by the magnifying glass in the `layer controls` panel. While
pan and zoom is selected editing the layer is not possible. Once you click on
pan and zoom is selected, editing the layer is not possible. Once you click on
one of the editing tools, pan and zoom is turned off. Return to pan and zoom
mode by pressing the `4` key when the `labels layer` is selected.
mode by pressing the `6` key when the `labels layer` is selected.

### Creating a new `labels layer`

Expand All @@ -258,21 +265,21 @@ them.

A particular label can be chosen in one of three ways:

* Using the label combobox inside the `layer controls` panel and typing in the
numeric value of the desired label
* Using the label control inside the `layer controls` panel and typing in the
numeric value of the desired label;

* Using the + or - buttons to get to the desired label color or press the default
keybinding `m` to set a new label.
* Using the + or - buttons to get to the desired label color or **press the
default keybinding `m` to set a new label;** DOESN'T WORK

* Selecting the `color picker` tool and then clicking on a pixel with the
desired label color in the image
desired label color in the image.

When a label is chosen its integer appears inside the label combobox and the
color of the label is shown in the thumbnail next to the label combobox. If the
0 label is selected, then a checkerboard pattern is shown in the thumbnail to
represent the transparent color.
When a label is chosen, the integer value associated with it appears inside the
label control and the color of the label is shown in the thumbnail next to the
control. If the 0 label is selected, then a checkerboard pattern is shown in the
thumbnail to represent the transparent color.

You can quickly select the color picker by pressing the `4` key when the labels
You can quickly select the color picker by pressing the `5` key when the labels
layer is selected.

While painting with a label, you can swap between the current (selected) label
Expand All @@ -293,25 +300,26 @@ and `fill bucket` tools. Below we show how to use these tools by performing
common editing tasks on connected components (keep the `contiguous` box checked).

* Creating or drawing a connected component
![image: draw component](../../images/draw_component.webm)
![Using the paintbrush and fill bucket tools to draw a connected component](../../images/draw_component.webm)

* Press `m` to select a label color that has not been used.
* Select the `paintbrush` tool and draw a closed contour around the object.
* Select the `fill bucket` tool and click inside the contour to assign the
label to all pixels of the object.

* Deleting a connected component
![image: delete label](../../images/delete_label.webm)
![Deleting selected labels](../../images/delete_label.webm)
Select the background label with the `color picker`, then use the
`fill bucket` to set all pixels of the
connected component to background.

* Merging connected components
![image: merge labels](../../images/merge_labels.webm)
![Selecting a label and merging with a connecting label](../../images/merge_labels.webm)
* Select the label of one of the components with the `color picker` tool.
* Select the `fill bucket` and fill the components to be merged.

* Splitting a connected component
![image: split label](../../images/split_label.webm)
![Using the paintbrush tool to split a label into two](../../images/split_label.webm)
Splitting a connected component will introduce an additional object.
* Press `m` to select a label not already in use.
* Use the `paintbrush` tool to draw a dividing line where you want to split
Expand Down
Binary file modified docs/images/delete_label.webm
Binary file not shown.
Binary file modified docs/images/draw_component.webm
Binary file not shown.
Binary file modified docs/images/editing_points.webm
Binary file not shown.
Binary file modified docs/images/editing_shapes.webm
Binary file not shown.
Binary file modified docs/images/merge_labels.webm
Binary file not shown.
Binary file modified docs/images/shape_resizing.webm
Binary file not shown.
Binary file modified docs/images/shape_vertex_editing.webm
Binary file not shown.
Binary file modified docs/images/split_label.webm
Binary file not shown.

0 comments on commit d76fb5c

Please sign in to comment.