napari-grid-curator
Interactive batch annotation tool for microscopy datasets with tiled grid visualization.
Overview
napari-grid-curator is a napari plugin for efficient manual curation of large microscopy datasets. The key feature is a tiled grid layout that displays many segmented objects simultaneously, allowing rapid quality control and annotation.
Key Features
- Tiled Grid Layout: View 100+ cells at once in an organized montage
- Batch Processing: Efficiently navigate through thousands of segmented objects
- 2D & 3D Support: Works with both 2D image stacks and 3D volumetric data with scrollable Z-stacks
- Dual View Modes:
- Mosaic Mode: See all cells in batch simultaneously
- Slide Mode: Navigate cell-by-cell with arrow keys
- Interactive Annotation:
- Alt + Click: Exclude/include individual cells
- Shift + Click: Mark cells as positive (thresholding)
- Quick Filters: DAPI intensity, nearest-neighbor distance and minimum nucleus area sliders
- Flexible Data Loading:
- Legacy mode (all data in single
.pkl) - Lazy mode (split per-scene
.pklfiles) - Minimal mode (on-the-fly cropping from original
.lif/.tiffiles)
- Legacy mode (all data in single
- Multi-channel Thresholding: Set per-channel thresholds with interactive histograms
- Smart Caching: Efficient caching for large 3D wholebrain datasets
Installation
Install directly from PyPI:
pip install napari-grid-curator
Or create a fresh conda/mamba environment with napari and the plugin, using
environment.yml
(download it, then run in the same folder):
mamba env create -f environment.yml # or: conda env create -f environment.yml
mamba activate napari-grid-curator
napari
Or create the same environment by hand, without the .yml file:
mamba create -n napari_rgc python=3.12 "napari>=0.10" pyqt6 "libblas=*=*openblas" "numcodecs<0.16" pip
mamba activate napari_rgc
python -m pip install napari-grid-curator # or e.g. napari-grid-curator==0.1.1
python -m napari
Notes for conda/mamba environments:
- Make sure the environment is activated before installing with pip.
python -m pipandpython -m naparialways use the active environment's Python. - Don't run
pip install -U napariorpip install "napari[all]"in a conda environment. That replaces conda's napari/Qt with pip's and breaks Qt on Windows (DLL load failed while importing QtWidgets). - The version pins avoid known problems:
aicsimageioneedszarr<2.16, which only works withnumcodecs<0.16. On some Windows machines the MKL maths library crashes, so OpenBLAS is used. - Qt6 (napari >= 0.10) is recommended. Older Qt5 environments (napari <= 0.6 with
pyqt=5) still work, but scaling the UI (see below) is unreliable there.
Or install latest development version:
pip install git+https://github.com/jojofranz/napari-grid-curator.git
Installing a specific version (upgrade / downgrade)
Run these in the environment that runs napari, then restart napari:
pip install --upgrade napari-grid-curator # latest release
pip install napari-grid-curator==0.1.1 # a specific version (also downgrades)
pip index versions napari-grid-curator # list available versions
pip show napari-grid-curator # show the installed version
Any tagged version can also be installed directly from GitHub:
pip install git+https://github.com/jojofranz/napari-grid-curator.git@v0.1.1
Usage
From napari GUI
- Open napari
- Go to Plugins > Grid Curator
- Load your dataset (
.pklfile) - Use mouse interactions to annotate:
- Alt + Click: Toggle cell inclusion/exclusion
- Shift + Click: Mark cell as positive
- Set thresholds per channel using histogram widget
- Export annotated dataset when done
⚠️ Warning: changing exclusion criteria resets manual exclusions. Whenever you change the exclusion metrics or any quick filter (DAPI intensity, min distance, min area: checkbox or slider), the
excludestatus of all nuclei in all scenes is recalculated from those criteria alone. All Alt + Click include/exclude decisions made before are lost. Changing the exclusion metrics also drops the quick-filter exclusions until a quick filter is changed again.Recommended workflow: first set the exclusion metrics and quick filters, then do the manual Alt + Click curation, then save. Don't touch the criteria after manual curation. Marker positivity (Shift + Click, thresholds) is not affected.
Quick filters
- DAPI intensity min: exclude nuclei with a mean DAPI intensity (
DAPI_inside,intensity_mean) below the threshold. - Min distance (px): exclude nuclei closer than the threshold to their nearest neighbour or to the image border.
- Min area (px): exclude nuclei with an area (
DAPI_inside,area, in pixels) below the threshold.
Each filter is switched on with its checkbox. A nucleus excluded by a filter is excluded in all channels.
Small screens: smaller napari menus
On small laptop screens the napari menus and the Grid Curator widget may not fit. The Grid Curator panel scrolls when it is taller than the window (the mouse wheel scrolls the panel; click a slider or field first to change its value with the wheel).
To make everything smaller, scripts/napari_scaled.py
starts napari with a smaller UI:
python scripts/napari_scaled.py # napari font size 7 (napari default: 9)
python scripts/napari_scaled.py --font-size 8
python scripts/napari_scaled.py --scale 0.7 # also shrink everything via QT_SCALE_FACTOR
python scripts/napari_scaled.py --plugin # also open the Grid Curator widget
--font-sizeuses napari's own font setting, works on any screen and only affects this session. It can also be set permanently in napari under File > Preferences > Appearance.--scalesetsQT_SCALE_FACTOR. This works well with Qt6 (napari >= 0.10). With Qt5 it is unreliable (cut-off menus and text, or widgets not drawn at all); the script warns in that case.
Without the script, set the same environment variables before starting napari:
| Shell | Smaller font | Scale everything |
|---|---|---|
| Windows cmd / Miniforge Prompt | set NAPARI_APPEARANCE_FONT_SIZE=7 |
set QT_SCALE_FACTOR=0.7 |
| PowerShell | $env:NAPARI_APPEARANCE_FONT_SIZE="7" |
$env:QT_SCALE_FACTOR="0.7" |
| Linux / macOS | export NAPARI_APPEARANCE_FONT_SIZE=7 |
export QT_SCALE_FACTOR=0.7 |
Supported Dataset Formats
The plugin works with three dataset modes:
- Legacy Mode: All images stored in single
.pklfile - Lazy Mode: Images split across per-scene
.pklfiles - Minimal Mode: References to original
.lifor.tiffiles with on-the-fly cropping
See DATASET_FORMATS.md for detailed format specifications.
Key Bindings
- Alt + Click: Toggle cell exclusion (include/exclude)
- Shift + Click: Toggle positive marker (for thresholding)
- C: Toggle the segmentation boundary overlay on DAPI (same as the checkbox; the viewer must have focus)
- Arrow Keys: Navigate between cells in slide mode (Left/Right)
- Mouse Wheel: Scroll through Z-slices (3D mode)
Use Cases
This plugin was originally developed for retinal ganglion cell (RGC) analysis but is applicable to:
- Quality control of automated segmentations
- Manual classification of cell types
- Thresholding based on marker expression
- Excluding edge artifacts or missegmented objects
- Any workflow requiring rapid inspection of many segmented objects
Development
This plugin was generated using the napari-plugin-template and follows napari plugin best practices.
Dataset Preparation
Your dataset should include:
- Images (2D or 3D, multi-channel)
- Segmentation labels
- Metadata table with regionprops (e.g., from
skimage.measure.regionprops_table)
The plugin uses bounding boxes to crop regions around each segmented object for efficient visualization.
Contributing
Contributions are welcome! Please open an issue or pull request on GitHub.
License
Distributed under the terms of the MIT license. "napari-grid-curator" is free and open source software.
Issues
If you encounter any problems, please file an issue with:
- Dataset format and size
- Full error traceback
- napari and plugin versions (
napari --info)
Acknowledgements
This plugin was developed for wholebrain RGC analysis and uses (amongst others):
- napari for visualization
- magicgui for GUI widgets
- matplotlib for histogram visualization
Development of this plugin was funded by NL-BioImaging AM and is happening at the MCL.
Metadata
Release files for napari-grid-curator 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| napari_grid_curator-0.1.3.tar.gz | 90.9 kB | Without provenance | Details for napari_grid_curator-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| napari_grid_curator-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for napari_grid_curator-0.1.3-py3-none-any.whl |
Total release size: 168.2 kB
Release files / napari_grid_curator-0.1.3.tar.gz
| Download URL | napari_grid_curator-0.1.3.tar.gz |
|---|---|
| Size | 90.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
28f4cbc98f0daf23bb074ee32d5da2be49f8f3b0f4ef7a0ff895ed762bc47c42
|
|
BLAKE2b-256 checksum How to use checksums |
2542481d774fb5b21a5ab5738a684fbb038b2c587f8b96262b913138df48034b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.16
|
Release files / napari_grid_curator-0.1.3-py3-none-any.whl
| Download URL | napari_grid_curator-0.1.3-py3-none-any.whl |
|---|---|
| Size | 77.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ad275ef156e1a634d009ecde4e8ec8fd61253fecf695a3541ebebc9be3e0e137
|
|
BLAKE2b-256 checksum How to use checksums |
e3b2faafb169e48856e132a75cad2e662fb5ea5c17e6e19f745c1c2786f08151
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.16
|
Security for napari-grid-curator 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.