Skip to content

Edit label images stored as image channels

Ziwen Liu edited this page Mar 27, 2024 · 6 revisions

Data format

The dataset must have one channel that contains labels, where the integer pixel value represents a categorical classification of the pixel. If this channel is not an integer type, it will be casted to uint16 before viewing and saving, which allows a maximum 65535 instances per FOV.

Launch

From CLI

napari --with napari-iohub "Edit labels"

From GUI

In napari GUI's menu bar, click Plugins -> napari iohub -> Edit labels.

Load FOV

Click 'Browse dataset' and select the dataset with images and labels to edit. Select FOV in the drop-down menus and click 'Load'. This could take a while if loading large images.

napari-iohub.mov

Edit

Use napari tools to edit the labels layer.

edit-labels.mov

Tips

Napari has built-in key bindings for frequent operations in annotation. For example, when a labels layer is selected:

  • Numbers select tools in their displayed order in layer controls
    • 3 switches to paint bucket
    • 5 switches to drag
  • - (minus) and = (plus) change the current label value
  • v toggles the visibility of the current layer

Save

For each time point, click 'Save' to save the work. This will only save the current time point in the current FOV.

  • If the save path is the same as input, this will edit in-place. A warning will be issued. The labels will be casted to the same data type of the original array, even if it is not an integer type.
  • If the save path is a new zarr store, the unsaved timepoints and FOVs in the source dataset will not appear in the saved annotations.
save-labels.mov

Full workflow example

  • Load image and labels
  • Adjust display
  • Configure output to the same dataset (edit in-place)
  • Edit and save for 3 frames
edit-workflow-compressed.mp4