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).
- 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)
-
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.
-
(Optional but recommended) Click Compute Stats (safe) The status area will show
selected,cells,maxID, andmergestate.
Hotkeys
These are convenience hotkeys for faster manual editing.
N— New ID (max+1)F— Fill closed shapeShift+F— Fill 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
- 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
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.3.tar.gz.
File metadata
- Download URL: napari_manual_labels_editor-0.1.3.tar.gz
- Upload date:
- Size: 26.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8dc3dfcb128f40cba717beba991679eeb184ef1d05b663ef18f46a09af53e436
|
|
| MD5 |
ff27998b7567c1b6b439ee461986edea
|
|
| BLAKE2b-256 |
1a4d0fade1809cac5c0fc379b54c4c8b26ce57470c96c8ea1296540c7b747373
|
File details
Details for the file napari_manual_labels_editor-0.1.3-py3-none-any.whl.
File metadata
- Download URL: napari_manual_labels_editor-0.1.3-py3-none-any.whl
- Upload date:
- Size: 17.6 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 |
c4e8f6e008700901b0f8231bfe95a4909f8e5a2b461ed41f89928586449dbec4
|
|
| MD5 |
dca12395daff7dce662b0042809fc3f1
|
|
| BLAKE2b-256 |
6788dd9e34ccc4a6509a6e29f1d2c46a5eebc2a1228abfbdfa5309b65532efcb
|