Skip to main content

Manual fine-tuning toolkit for napari Labels: compute stats, assign new IDs, delete/merge labels, relabel to 1..N, and save LZW BigTIFF safely.

Project description

napari-manual-labels-editor

Manual fine-tuning toolkit for napari Labels (integer label masks). Designed for “after segmentation” workflows where you need to inspect, fix, and export large label images safely (e.g., TIFF/LZW/BigTIFF).

Tutorial video: https://www.youtube.com/watch?v=cQf_7ExGQHk&t=15s

What it does

This plugin operates on a napari Labels layer (background must be 0) and provides a small, fast panel to:

  • Pick Active Layer: choose the current active Image/Labels layer; if it’s an Image, it can be converted to Labels (integer).
  • Compute Stats (safe): compute maxID and cells without heavy np.unique (safer for large arrays).
  • New ID (max+1): set selected label to maxID + 1 so you can paint a new object.
  • Delete selected ID: delete the currently selected label ID (set its pixels to 0).
  • Compact IDs Order (1..N): relabel present IDs to consecutive 1..N (useful before export).
  • Merge (Shift-click): when merge is enabled, Shift-click A, then Shift-click B to merge B → A (into A).
  • Fill closed shape: draw a closed outline, then fill the enclosed region for the selected label.
  • Filter small labels (to new layer): remove tiny fragments by area threshold while keeping the original layer unchanged.
  • Undo / Redo: revert recent edits made through the plugin’s actions.
  • Blink: quick visibility toggling for spot-checking edits.

Export:

  • Save labels to TIFF (LZW) (BigTIFF enabled). If you provide a directory as “Save path”, the plugin auto-appends a filename.

Compatibility

  • Python: 3.10–3.13 (tested on 3.11)
  • napari: 0.6.x
  • Layer type: Labels (integer), background 0

Installation

From PyPI (recommended)

pip install napari-manual-labels-editor

If you don’t have napari yet:

pip install "napari[all]" napari-manual-labels-editor

From GitHub (latest main)

pip install -U "git+https://github.com/yaohualee1215-bit/napari-manual-labels-editor.git"

Usage (inside napari)

  1. Launch napari and load your Labels layer (and optional background image).

  2. Open the plugin panel:

    Plugins → Manual Labels Editor → Manual Labels Editor

  3. Click Pick Active Layer (Image or Labels) Make sure the layer you want is the active layer in the layer list first.

  4. (Optional but recommended) Click Compute Stats (safe) The status area will show selected, cells, maxID, and merge state.

Hotkeys

These are convenience hotkeys for faster manual editing.

  • NNew ID (max+1)
  • FFill closed shape
  • Shift+FFill closed shape + Next ID

Notes:

  • Hotkeys are captured by the napari viewer. If a key seems unresponsive, click once on the canvas to give the viewer focus.
  • napari also has its own built-in tools/hotkeys (e.g., paint/fill modes); you can keep using those alongside this plugin.

Undo / Redo behavior

  • Undo/Redo reverts recent pixel edits made via the plugin’s actions (e.g., fill closed, delete, merge, relabel/filter).
  • Changing the selected label / “New ID” alone does not change pixels, so it is not treated as an edit step to undo.
  • Standard behavior: if you Undo and then make a new edit, the Redo history is cleared.

Export

  1. Set Save path (file path or directory)
  2. Click Save labels to TIFF (LZW)

Notes:

  • TIFF writer uses compression="lzw" and bigtiff=True.
  • If “Save path” is a directory, output becomes: <dir>/<layer_name>_edited_LZW.tif (or your configured suffix).

Notes

Large LZW TIFF support

If LZW read/write fails or is slow, install imagecodecs:

conda install -c conda-forge imagecodecs

License

BSD-3-Clause

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

napari_manual_labels_editor-0.1.3.tar.gz (26.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

napari_manual_labels_editor-0.1.3-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file napari_manual_labels_editor-0.1.3.tar.gz.

File metadata

File hashes

Hashes for napari_manual_labels_editor-0.1.3.tar.gz
Algorithm Hash digest
SHA256 8dc3dfcb128f40cba717beba991679eeb184ef1d05b663ef18f46a09af53e436
MD5 ff27998b7567c1b6b439ee461986edea
BLAKE2b-256 1a4d0fade1809cac5c0fc379b54c4c8b26ce57470c96c8ea1296540c7b747373

See more details on using hashes here.

File details

Details for the file napari_manual_labels_editor-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for napari_manual_labels_editor-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c4e8f6e008700901b0f8231bfe95a4909f8e5a2b461ed41f89928586449dbec4
MD5 dca12395daff7dce662b0042809fc3f1
BLAKE2b-256 6788dd9e34ccc4a6509a6e29f1d2c46a5eebc2a1228abfbdfa5309b65532efcb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page