Skip to main content

Manual curation in napari: quickly pick the best cell/nuclei masks from segmentation outputs (Cellpose/Baysor/parameter sweeps), with new IDs, undo, overlap pruning, compact save, and fast logging.

Project description

A napari dock widget for manual curation of segmentation masks. It is designed for workflows where you generate multiple candidate masks (e.g., Cellpose/Baysor/parameter sweeps), and then quickly pick the best instance per cell/nucleus inside napari with full traceability.

Key features

  • Follow → Work: create a working copy *.mask__work from your selected mask layer, so the original stays untouched.
  • Collect (Always NEW ID): click an object in __work to copy it into manual_best with a new unique label ID.
  • Undo (U / Alt-U): revert the last collect and restore the exact pre-click state.
  • Overlap prune (P / Alt-P): remove candidate objects in __work that overlap too much with manual_best (avoid duplicates).
  • Compact save (S / Alt-S): before saving, relabel manual_best to consecutive IDs (1..N).
  • Fast logging: JSONL + TSV logs of every action (for methods papers / traceability).
  • Blink: toggle selected layer visibility at 0.5s to compare masks quickly.

Compatibility

  • Python: 3.10–3.13 (tested on 3.11)
  • napari: 0.6.x (tested on 0.6.6)

What input masks should look like

  • Input mask should be a Labels layer.
  • The layer name is expected to contain .mask (example: d290_cp0_fl0.2.mask).
    • This is how the plugin identifies which layers are “candidate masks”.

Tip: if your mask is a LZW-compressed TIFF and napari fails to open it, install imagecodecs:

conda install -c conda-forge imagecodecs

Typical workflow

  1. Open napari
  2. Load:
    • A background image (optional), e.g. DAPI
    • A candidate mask Labels layer, e.g. d290_cp0_fl0.2.mask
  3. Open the panel: Plugins → Mask Curator → Mask Curation
  4. Select your *.mask layer and click Follow → Work + Prune
    • Creates *.mask__work
    • Creates/uses manual_best
  5. Click Collect: OFF (A) to switch it to Collect: ON
  6. Left-click objects in __work to collect into manual_best
  7. If you mis-click, press Undo (or U / Alt-U)
  8. Press Prune Now (or P / Alt-P) to prune overlaps
  9. Press Save manual_best (or S / Alt-S) to export final curated masks with compact IDs.

Hotkeys

  • Alt-A: Toggle Collect ON/OFF
  • Alt-U: Undo last collect
  • Alt-P: Prune Now
  • Alt-R: Reset Work
  • Alt-S: Save manual_best

(Buttons are also provided for all actions.)

Parameters (panel)

  • Overlap prune thr: candidates are removed if overlap ratio ≥ thr
  • ROI pad(px): padding around object bbox used for fast local updates

Outputs

When saving, the plugin writes:

  • manual_best_ID_uint32.tif — curated Labels with compact consecutive IDs (1..N)
  • manual_best_black_uint8.tif — binary mask (0/255)
  • manual_best_id_map_old_to_new.tsv — mapping from pre-save IDs to compact IDs

Logs (traceability):

  • curation_logs/curation_<timestamp>.jsonl
  • curation_logs/curation_<timestamp>.tsv

Installation

From PyPI

pip install napari-mask-curator

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_mask_curator-0.1.1.tar.gz (23.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_mask_curator-0.1.1-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: napari_mask_curator-0.1.1.tar.gz
  • Upload date:
  • Size: 23.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for napari_mask_curator-0.1.1.tar.gz
Algorithm Hash digest
SHA256 838f0a54346429a3afc94c7cf22ce4bf6bda7cc9bff0044a74b70f30a227ef70
MD5 3df3b2568b0d649b62943db6610bf6c9
BLAKE2b-256 25d90a4ede0fffddf1a532fd9911ebc137a12c3316492ea28db32ad3d6f0b5bb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for napari_mask_curator-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 04c7276411a753d7e3cc84d5b2a7056f14ce248f9c4dc404ffe4ac2c2ffdfc3c
MD5 5b863a7e50e6d316eae832c7eaa73b5a
BLAKE2b-256 d83ecb3c7e44b32f53141afa545053688a3d5ed6fbbd09368545e6349370d8fa

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