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.1.tar.gz (25.8 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.1-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for napari_manual_labels_editor-0.1.1.tar.gz
Algorithm Hash digest
SHA256 25c6e7e2f70556426d4c76f1935f7857b3d0837e55325e532c15e5494e8cf5cb
MD5 e7e45c64f9ad75e3b8d6e08923247e74
BLAKE2b-256 d28fa017c7fd45733825834e42e82cd876b4495674e791f1721e23a331d42e23

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for napari_manual_labels_editor-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4e8f510c03cfaef2254a4837542cce94db16755136e0166d4f2bad9a9f60d8b8
MD5 79f6a5ce77c0766e4a4908af5f6d835f
BLAKE2b-256 579babcf44560a483f97cb8e38f70f897a5c02db7df20504b4a14dae95a99ae6

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