Cell/nuclei counter using cellpose models
Project description
cellpose-counter
A Napari plugin for cell/nuclei counting from a region or interest using cellpose models.
Installation
Option 1: Install in Napari directly under the plugins tab and select cellpose-counter.
Option 2: 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
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.
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
Project details
Release history Release notifications | RSS feed
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 cellpose_counter-0.1.3.tar.gz.
File metadata
- Download URL: cellpose_counter-0.1.3.tar.gz
- Upload date:
- Size: 2.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
755ff03ed38c0a448f8d292c3362b38cc22130036e1b16911f60561ecbc591fb
|
|
| MD5 |
c7c96ed973876446ae209a65f648572c
|
|
| BLAKE2b-256 |
6c88d4cbf09da614244b75f72b0840a9aca96ffb83ce99fd1d91cb06de7c24b7
|
File details
Details for the file cellpose_counter-0.1.3-py3-none-any.whl.
File metadata
- Download URL: cellpose_counter-0.1.3-py3-none-any.whl
- Upload date:
- Size: 2.4 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5269f82512c635fbe84a0f4b94801d39faf8d2d3a359f3ccfc244d03ed5ee49a
|
|
| MD5 |
86e3cc8bb8801b12502ea64061a48a70
|
|
| BLAKE2b-256 |
ca30d5f073a3276a192d4be10562cf8e2574193032beafd87e44ac324c3ebca9
|