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).

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. Click Compute Stats (safe) The status area will show selected, cells, maxID, and merge state.

Editing actions

  • New ID (max+1) → then paint to add a new label
  • Delete selected ID → remove a label
  • Compact IDs Order (1..N) → relabel to 1..N
  • Merge (Shift-click) → enable merge, then Shift-click label A then label B to merge B → A

New in v0.1.1

  • Added local closed-shape fill (draw a closed outline, then fill inside).
  • Added small-label area filtering to a new layer (keeps original layer unchanged).
  • Added undo/redo for merge and delete (recent edits only).
  • Added automatic refresh after merge/delete so edits display immediately.
  • Added blink controls for quick visual checking after edits.

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

Publish to PyPI (maintainers)

Maintainer-only. Regular users should install from PyPI above.

Release workflow (one block)

# from repo root
# 1) bump version in pyproject.toml (e.g., 0.1.0 -> 0.1.1)

# 2) run checks
pre-commit run --all-files

# 3) build + upload
python -m pip install -U build twine
rm -rf dist build *.egg-info
python -m build
twine check dist/*
twine upload dist/*

# 4) tag on GitHub
git tag v0.1.1
git push --tags

Clean env smoke test (optional)

conda create -n napari-mlabels-test -y python=3.11
conda activate napari-mlabels-test
python -m pip install -U pip
python -m pip install napari-manual-labels-editor

python - <<'PY'
import importlib.metadata as im
print("pkg version:", im.version("napari-manual-labels-editor"))
eps = [e for e in im.entry_points(group="napari.manifest") if "manual-labels-editor" in e.name]
print("entrypoints:", eps)
PY

napari

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.2.tar.gz (26.0 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.2-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for napari_manual_labels_editor-0.1.2.tar.gz
Algorithm Hash digest
SHA256 68e5f0975b43dba152ae4e798fae89ce776440bf20893fcc1e7e27c08fce721c
MD5 d79a2f24f738ba3b5e1561fee0d69817
BLAKE2b-256 89e8d6462e32ad98f1e717cfe3ede92a48f563f6e9eec22b8d5a8c6dd60a293d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for napari_manual_labels_editor-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1c1c524f8bb675402faa85e6d86cb87ad8cd7fd9e207ad6ccf8ec48e6e5f55dd
MD5 5d7344b289667995203a964ef5343d44
BLAKE2b-256 98674df706b1a53774f71c14e23434208e6bbd2b4f6f9646bbe26452f43dba0d

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