cellpose-counter
A Napari plugin for cell/nuclei counting from a region or interest using cellpose models.
Installation
Option 1: via pip (or pip alternatives like uv):
Below is a minimally working example of setting up a new virtual environment and installing the counter module with uv on Unix based systems.
uv venv # create virtual environment in .venv
source .venv/bin/activate
uv pip install "napari[all]" cellpose-counter
Option 2: via Docker/Podman. The provide Dockerfile can be used to install Napari and the counter plugin along with a preconfigured Xpra server using the napari-xpra image. Below is an example of building the image and running the application with GPU support.
podman build -t cellpose-counter .
podman run -it -d \
-p 9876:9876 \
-e XPRA_START="python3 -m napari -w cellpose-counter" \
--device nvidia.com/gpu=all
Then, navigate to http://localhost:9876 to view the application in a virtual
machine.
Note: There is a known issue installing the plugin directly from Napari. Please see this issue for more updates.
GPU Acceleration
To enable GPU acceleration, you will need a CUDA capable GPU along with the CUDA toolkit and cudNN library.
For instructions on installing cuda toolkit and cudNN, see:
Once these are installed, update the pytorch package by first uninstalling torch (if already instsalled).
uv pip uninstall torch
Then install a torch version that is compatible with your CUDA version. For example,
uv pip install torch --index-url https://download.pytorch.org/whl/cu118
After installation, you can verify in an interactive python console with:
import torch
torch.cuda.is_available()
Usage
To open Napari with the cellpose counter loaded, run napari -w cellpose-counter.
A dock widget will be open on the right side of the Napari interface. There you can view options for restoring images (using the cellpose denoise module), and counting cells/nuclei in a region of interest (ROI).
A few important notes:
- Images in TIFF or CZI file formats may be used.
- Images must be grayscale or single channel. RGB images may be loaded, but
should be split. You can do this by right clicking on the image and select
split rgborsplit stack. - ROIs can be drawn using the shape layer tools. Only a single ROI can be drawn per shape layer (otherwise only the first draw ROI will be used).
- ROIs should be square or rectangular. You can draw ROIs as polygons or other shapes, but a bounding box will be made from these shapes anyway.
- For long running processes such as image restoration or counting, it may seem like Napari is not doing anything. Notifications are shown in the viewer to display import information and a small activity indicator can be seen in the bottom right hand corner. If this indicator is spinning, then work is being done even if it doesn't look like it.
- In case of a large number of uncounted nuclei, consider modifying the
segmentation parameters, or use the
Continue Countingoption to re-run the segmentation on uncounted nuclei.
Updating
-
via Napari plugin manager. Select cellpose-counter plugin and update button.
-
via pip (or uv, ..., etc.)
uv pip install cellpose-counter --upgrade
Contributing
All contributions are welcome. Please submit an issue for feedback or bugs.
Citations
This plugin is built on top of the Cellpose segmentation and denoising models. If you use this plugin, please cite the following paper:
@article{stringer2021cellpose,
title={Cellpose: a generalist algorithm for cellular segmentation},
author={Stringer, Carsen and Wang, Tim and Michaelos, Michalis and Pachitariu, Marius},
journal={Nature Methods},
volume={18},
number={1},
pages={100--106},
year={2021},
publisher={Nature Publishing Group}
}
License
Metadata
Release files for cellpose-counter 0.1.8
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 |
|---|---|---|---|---|
| cellpose_counter-0.1.8.tar.gz | 2.6 MB | Without provenance | Details for cellpose_counter-0.1.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cellpose_counter-0.1.8-py3-none-any.whl | Python 3 | none | any | Details for cellpose_counter-0.1.8-py3-none-any.whl |
Total release size: 5.0 MB
Release files / cellpose_counter-0.1.8.tar.gz
| Download URL | cellpose_counter-0.1.8.tar.gz |
|---|---|
| Size | 2.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5690f151a27c5ce8fa26d7368649d18da36532941aea6b58ef85b14cdd8dd0ed
|
|
BLAKE2b-256 checksum How to use checksums |
6198b5831f42d56c11150c0991b8bff1df12900f68029e7e9563b3d83100f582
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.10.15
|
Release files / cellpose_counter-0.1.8-py3-none-any.whl
| Download URL | cellpose_counter-0.1.8-py3-none-any.whl |
|---|---|
| Size | 2.4 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7c83d4a0c0a3051de579d6e974fd8fec977f3d03535b1010a253a2e361881402
|
|
BLAKE2b-256 checksum How to use checksums |
d64aabeda1277f1e48ce0aaf4733a20319e6ddd303d56b01cc48f56d09d0bbad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.10.15
|
Security for cellpose-counter 0.1.8
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.