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
maxIDandcellswithout heavynp.unique(safer for large arrays). - New ID (max+1): set selected label to
maxID + 1so 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)
-
Launch napari and load your Labels layer (and optional background image).
-
Open the plugin panel:
Plugins → Manual Labels Editor → Manual Labels Editor
-
Click Pick Active Layer (Image or Labels) Make sure the layer you want is the active layer in the layer list first.
-
Click Compute Stats (safe) The status area will show
selected,cells,maxID, andmergestate.
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
- Set Save path (file path or directory)
- Click Save labels to TIFF (LZW)
Notes:
- TIFF writer uses
compression="lzw"andbigtiff=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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file napari_manual_labels_editor-0.1.1.tar.gz.
File metadata
- Download URL: napari_manual_labels_editor-0.1.1.tar.gz
- Upload date:
- Size: 25.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25c6e7e2f70556426d4c76f1935f7857b3d0837e55325e532c15e5494e8cf5cb
|
|
| MD5 |
e7e45c64f9ad75e3b8d6e08923247e74
|
|
| BLAKE2b-256 |
d28fa017c7fd45733825834e42e82cd876b4495674e791f1721e23a331d42e23
|
File details
Details for the file napari_manual_labels_editor-0.1.1-py3-none-any.whl.
File metadata
- Download URL: napari_manual_labels_editor-0.1.1-py3-none-any.whl
- Upload date:
- Size: 17.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e8f510c03cfaef2254a4837542cce94db16755136e0166d4f2bad9a9f60d8b8
|
|
| MD5 |
79f6a5ce77c0766e4a4908af5f6d835f
|
|
| BLAKE2b-256 |
579babcf44560a483f97cb8e38f70f897a5c02db7df20504b4a14dae95a99ae6
|