Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
180 changes: 61 additions & 119 deletions .napari-hub/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,47 @@
# napari-nuclephaser
# NuclePhaser: Cell Proliferation Measurement & Cell Tracking Assistant Plugin for Timelapse Images

A Napari plugin to detect and count nuclei on phase contrast images
[![License MIT](https://img.shields.io/pypi/l/napari-nuclephaser.svg?color=green)](https://github.com/nikvo1/napari-nuclephaser/raw/main/LICENSE)
[![PyPI](https://img.shields.io/pypi/v/napari-nuclephaser.svg?color=green)](https://pypi.org/project/napari-nuclephaser)
[![Python Version](https://img.shields.io/pypi/pyversions/napari-nuclephaser.svg?color=green)](https://python.org)
[![tests](https://github.com/nikvo1/napari-nuclephaser/workflows/tests/badge.svg)](https://github.com/nikvo1/napari-nuclephaser/actions)
[![napari hub](https://img.shields.io/endpoint?url=https://api.napari-hub.org/shields/napari-nuclephaser)](https://napari-hub.org/plugins/napari-nuclephaser)
[![npe2](https://img.shields.io/badge/plugin-npe2-blue?link=https://napari.org/stable/plugins/index.html)](https://napari.org/stable/plugins/index.html)
[![Copier](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/copier-org/copier/master/img/badge/badge-grayscale-inverted-border-purple.json)](https://github.com/copier-org/copier)

napari-nuclephaser utilizes [Ultralytics](https://docs.ultralytics.com/) YOLO object detection models and [obss/sahi](https://github.com/obss/sahi) sliced inference methods to detect cell nuclei on phase contrast (and other brightfield) images of any size, including large whole slide ones. Learn more with [documentation](https://napari-nuclephaser.readthedocs.io/en/latest/index.html).
A Napari plugin for automated cell nuclei detection, proliferation and population growth analysis, and single-cell tracking in brightfield and fluorescent nuclei timelapse microscopy images.

For more information, see our [GitHub page](https://github.com/nikvo1/napari-nuclephaser), [documentation](https://napari-nuclephaser.readthedocs.io/en/latest/index.html) and [paper](https://www.biorxiv.org/content/10.1101/2025.05.13.653705v1)
napari-nuclephaser is an open-source Napari plugin designed for scientists who need to measure cell proliferation rates, analyze population growth, and perform individual cell tracking on timelapse microscopy images. It utilizes [Ultralytics](https://docs.ultralytics.com/) YOLO object detection models and [obss/sahi](https://github.com/obss/sahi) sliced inference methods to detect cell nuclei on brightfield and fluorescent images of any size, including large whole slide ones. Learn more with [documentation](https://napari-nuclephaser.readthedocs.io/en/latest/index.html) and [paper](https://www.biorxiv.org/content/10.1101/2025.05.13.653705v1).

# Nuclei detection
## Nuclei detection

We trained a series of [YOLOv5](https://github.com/ultralytics/yolov5) and [YOLOv11](https://github.com/ultralytics/ultralytics) models to detect nuclei on phase contrast images. It can be used for counting cells or for individual cell tracking (using nuclei detections as tracking marks). Prominent features of this approach are:
We trained a series of [YOLOv5](https://github.com/ultralytics/yolov5) and [YOLOv11](https://github.com/ultralytics/ultralytics) models to detect nuclei on phase contrast images. It can be used for counting cells or for individual cell tracking (using nuclei detections as tracking markers). Prominent features of this approach are:
- Napari-nuclephaser plugin includes [obss/sahi](https://github.com/obss/sahi) functionality, allowing detection on images of arbitrary sizes.

<p align="center">
<picture>
<source srcset=https://github.com/user-attachments/assets/60aca59e-072f-4c17-802e-c42b58fd740c height = "400">
<img alt="Image didn't load" src=https://github.com/user-attachments/assets/60aca59e-072f-4c17-802e-c42b58fd740c>
</picture>
</p>
<picture>
<source media="(prefers-color-scheme: dark)" srcset=https://github.com/user-attachments/assets/aa321f17-b0e2-4161-8a69-cb732d7065a7 height=400>
<img alt="Image didn't load" src=https://github.com/user-attachments/assets/fe4d6436-3490-4c06-8ddd-7c797976f407 height=400>
</picture>
</picture>

- YOLO models are fast, providing reasonable inference speed even with CPU.
- Ability to predict and automatically count nuclei on stacks of images, making it convenient for cell population growth studies and individual cell tracking.

<p align="center">
<picture>
<source srcset=https://github.com/user-attachments/assets/ccf7ee11-9189-4ac6-bd93-c7bcd582f90e height = "400">
<img alt="Image didn't load" src=https://github.com/user-attachments/assets/ccf7ee11-9189-4ac6-bd93-c7bcd582f90e>
</picture>
</p>
<picture>
<source media="(prefers-color-scheme: dark)" srcset=https://github.com/user-attachments/assets/feba9a99-1d37-4962-a2e6-175052aa4925>
<img alt="Image didn't load" src="https://github.com/user-attachments/assets/c7e4d0e6-44c1-4268-aae5-6bb78500d928">
</picture>

- Calibration algorithm that allows measuring accuracy for each specific use case.

# Calibration algorithm
## Calibration algorithm

Result of object detection model inference is highly dependent on _confidence threshold_ parameter.

<p align="center">
<picture>
<source srcset=https://github.com/user-attachments/assets/99f47f85-92df-4680-9e22-8c686fd9bdc0 height = "400">
<img alt="Image didn't load" src=https://github.com/user-attachments/assets/99f47f85-92df-4680-9e22-8c686fd9bdc0>
<source media="(prefers-color-scheme: dark)" srcset=https://github.com/user-attachments/assets/8a13085f-c7ea-45f0-8931-6851f21b68a0 height="300">
<img alt="Image didn't load" src=https://github.com/user-attachments/assets/89f76cd7-2db7-4241-bc35-36d23332b2b5 height="300">
</picture>
</p>

Expand All @@ -47,16 +53,38 @@ We created several calibration (finding optimal confidence threshold) algorithms
Apart from optimal confidence threshold search, these algorithms return accuracy metrics for specific use cases. Given that the calibration image is large, only part of it is used for search of threshold, while the second part is used for evaluation model's accuracy.
Accuracy metrics are [Mean Absolute Percentage Error (MAPE)](https://en.wikipedia.org/wiki/Mean_absolute_percentage_error) and prediction-ground truth scatterplot, which shows how well model performs with different densities of cells.

Learn more about calibration in [documentation](https://napari-nuclephaser.readthedocs.io/en/latest/General%20information/Confidence%20threshold%20calibration.html).
Learn more about calibration in [documentation](https://napari-nuclephaser.readthedocs.io/en/latest/Biological%20tasks%20guidelines/Individual%20cells%20tracking.html).

<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset=https://github.com/user-attachments/assets/6d89e22b-2728-40fb-839d-3c6681e29c97>
<img alt="Image didn't load" src=https://github.com/user-attachments/assets/6a574845-4ad2-4802-b0f8-f1d908aa585a>
</picture>
</p>

## Cell Proliferation Measurement & Population Growth Analysis

With NuclePhaser you can reconstruct population growth curves from timelapse images of growing cell population by counting number of nuclei on each image. Key features of this approach are:

- No special equipment, reagents or dyes required, only regular culture plastic and cell growth medium, microscope with mechanical stage and a PC (even without GPU).
- [Accuracy measurement for each specific use case](https://napari-nuclephaser.readthedocs.io/en/latest/General%20information/Confidence%20threshold%20calibration.html), so you will be sure the tool is working with appropriate precision.
- Measuring the number of cells, not the area occupied by cells, which can be significantly influenced by spreading/narrowing of cells.
- Complete reproducibility of results with metadata.txt files saved for each experiment.

<p align="center">
<picture>
<source srcset=https://github.com/user-attachments/assets/d52ee877-a66e-4db0-b1bc-23d938718a57>
<img alt="Image didn't load" src=https://github.com/user-attachments/assets/d52ee877-a66e-4db0-b1bc-23d938718a57>
<source media="(prefers-color-scheme: dark)" srcset=https://github.com/user-attachments/assets/47b6cee0-7f4a-440f-84ed-de2a5aa2aa36>
<img alt="Image didn't load" src=https://github.com/user-attachments/assets/5a084f1a-f977-41fa-b4be-55f37bdf9996>
</picture>
</p>

# Models
For more detailed information about how NuclePhaser can be used for cell proliferation measurement & population growth analysis, visit our [documentation](https://napari-nuclephaser.readthedocs.io/en/latest/Biological%20tasks%20guidelines/Population%20growth%20curves.html#).

## Individual cell tracking

NuclePhaser can be used as an assistant for individual cells tracking. This task is extremely difficult, and manual tracking is still the only method with 100% proof against false tracks. With NuclePhaser, you can significantly simplify manual tracking: instead of marking each cell on each image, you can predict nuclei location with NuclePhaser and then correct the result, which is **much** faster. Learn more in [documentation](https://napari-nuclephaser.readthedocs.io/en/latest/Biological%20tasks%20guidelines/Individual%20cells%20tracking.html).

## Models

Currently only YOLOv5n, YOLOv5s, YOLOv11n and YOLOv11s models, as well as fluorescent nuclei detector YOLOv5n are downloaded automatically with pip install napari-nuclephaser. To use larger models, download them with these links:

Expand Down Expand Up @@ -93,7 +121,7 @@ Brighfield nuclei detectors
</div>

> [!NOTE]
> Feel free to use the models published there without the plugin!
> Feel free to use the models published here without the plugin!

# Plugin functionality
napari-nuclephaser plugin offers following widgets:
Expand All @@ -107,8 +135,8 @@ napari-nuclephaser plugin offers following widgets:

Learn more about widgets and their functionality at [documentation](https://napari-nuclephaser.readthedocs.io/en/latest/index.html).

# Citation

## Citation
If you use NuclePhaser in your work, please cite our preprint:
```bibtex
@article {Voloshin2025.05.13.653705,
author = {Voloshin, Nikita and Putlyaev, Egor and Chechekhina, Elizaveta and Usachev, Vladimir and Karagyaur, Maxim and Bozov, Kirill and Grigorieva, Olga and Tyurin-Kuzmin, Pyotr and Kulebyakin, Konstantin},
Expand All @@ -121,97 +149,9 @@ Learn more about widgets and their functionality at [documentation](https://napa
}
```

## Installation

----------------------------------

This [napari] plugin was generated with [copier] using the [napari-plugin-template].

<!--
Don't miss the full getting started guide to set up your new package:
https://github.com/napari/napari-plugin-template#getting-started

and review the napari docs for plugin developers:
https://napari.org/stable/plugins/index.html
-->

# Installation

### Option 1: Using Anaconda (recommended)

We recommend installation using [Anaconda Distribution](https://www.anaconda.com/)

1. Install Anaconda with [Installation instructions](https://www.anaconda.com/docs/getting-started/anaconda/install)

2. Open Anaconda Prompt using Search Bar or Anaconda Navigator

3. Create new environment with default anaconda packages using command

```sh
conda create --name napari-env anaconda
```
4. Activate new environment using command

```sh
conda activate napari-env
```
5. Install [Napari](https://napari.org/stable/) using command

```sh
pip install napari[all]
```
6. Verify napari installation using following command. It should open napari GUI.

```sh
napari
```
7. Install napari-nuclephaser plugin using command

```sh
pip install napari-nuclephaser
```
8. Plugin is ready to be used! Start napari by typing

```sh
napari
```
Initialize plugin's widgets by opening Plugins window and choosing NuclePhaser.

### Installation with GPU

If you have [NVIDIA GPU with CUDA](https://developer.nvidia.com/cuda-gpus), you can significantly increase plugin's speed.

To install GPU-powered version of the plugin, you first need to do all the steps for the installation using Anaconda (above). Then you need to:

1. Install CUDA using [official instructions](https://developer.nvidia.com/cuda-downloads)
> [!NOTE]
> Check which versions of CUDA are supported by current [torch installation](https://pytorch.org/get-started/locally/) and consider [installing earlier ones](https://developer.nvidia.com/cuda-toolkit-archive)

2. Check CUDA installation with nvidia-smi command in the command line.

```sh
nvidia-smi
```
3. In the environment with napari and napari-nuclephaser installed, install CUDA-supported torch by typing specific command for your system, which can be found at [torch installation page](https://pytorch.org/get-started/locally/). For example, if you have Windows-based system and CUDA 12.6, your line should look like

```sh
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126
```

> [!WARNING]
> During our tests, torchvision wasn't installed using this line. To avoid that, add -U after install:
> ```sh
>pip3 install -U torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126
>```

----------------------------------

### Option 2: Using standalone napari app (simpler)

1. Download and install napari as standalone app using [installation instructions](https://napari.org/dev/tutorials/fundamentals/installation_bundle_conda.html)

2. Search, download and install napari-nuclephaser plugin by opening the app, navigating to Plugins window and choosing Install/Uninstall plugins...

----------------------------------
For detailed installation instructions, visit our [documentation](https://napari-nuclephaser.readthedocs.io/en/latest/Installation/Installation.html).

## Contributing

Expand All @@ -227,8 +167,6 @@ Distributed under the terms of the [MIT] license,

If you encounter any problems, please [file an issue] along with a detailed description.

(This is a Napari-specific description)

[napari]: https://github.com/napari/napari
[copier]: https://copier.readthedocs.io/en/stable/
[@napari]: https://github.com/napari
Expand All @@ -246,3 +184,7 @@ If you encounter any problems, please [file an issue] along with a detailed desc
[tox]: https://tox.readthedocs.io/en/latest/
[pip]: https://pypi.org/project/pip/
[PyPI]: https://pypi.org/

This [napari] plugin was generated with [copier] using the [napari-plugin-template].

This is a Napari-specific description.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ A Napari plugin for automated cell nuclei detection, proliferation and populatio

napari-nuclephaser is an open-source Napari plugin designed for scientists who need to measure cell proliferation rates, analyze population growth, and perform individual cell tracking on timelapse microscopy images. It utilizes [Ultralytics](https://docs.ultralytics.com/) YOLO object detection models and [obss/sahi](https://github.com/obss/sahi) sliced inference methods to detect cell nuclei on brightfield and fluorescent images of any size, including large whole slide ones. Learn more with [documentation](https://napari-nuclephaser.readthedocs.io/en/latest/index.html) and [paper](https://www.biorxiv.org/content/10.1101/2025.05.13.653705v1).

# Nuclei detection
## Nuclei detection

We trained a series of [YOLOv5](https://github.com/ultralytics/yolov5) and [YOLOv11](https://github.com/ultralytics/ultralytics) models to detect nuclei on phase contrast images. It can be used for counting cells or for individual cell tracking (using nuclei detections as tracking markers). Prominent features of this approach are:
- Napari-nuclephaser plugin includes [obss/sahi](https://github.com/obss/sahi) functionality, allowing detection on images of arbitrary sizes.
Expand All @@ -34,7 +34,7 @@ We trained a series of [YOLOv5](https://github.com/ultralytics/yolov5) and [YOLO

- Calibration algorithm that allows measuring accuracy for each specific use case.

# Calibration algorithm
## Calibration algorithm

Result of object detection model inference is highly dependent on _confidence threshold_ parameter.

Expand Down Expand Up @@ -62,7 +62,7 @@ Learn more about calibration in [documentation](https://napari-nuclephaser.readt
</picture>
</p>

# Cell Proliferation Measurement & Population Growth Analysis
## Cell Proliferation Measurement & Population Growth Analysis

With NuclePhaser you can reconstruct population growth curves from timelapse images of growing cell population by counting number of nuclei on each image. Key features of this approach are:

Expand All @@ -80,11 +80,11 @@ With NuclePhaser you can reconstruct population growth curves from timelapse ima

For more detailed information about how NuclePhaser can be used for cell proliferation measurement & population growth analysis, visit our [documentation](https://napari-nuclephaser.readthedocs.io/en/latest/Biological%20tasks%20guidelines/Population%20growth%20curves.html#).

# Individual cell tracking
## Individual cell tracking

NuclePhaser can be used as an assistant for individual cells tracking. This task is extremely difficult, and manual tracking is still the only method with 100% proof against false tracks. With NuclePhaser, you can significantly simplify manual tracking: instead of marking each cell on each image, you can predict nuclei location with NuclePhaser and then correct the result, which is **much** faster. Learn more in [documentation](https://napari-nuclephaser.readthedocs.io/en/latest/Biological%20tasks%20guidelines/Individual%20cells%20tracking.html).

# Models
## Models

Currently only YOLOv5n, YOLOv5s, YOLOv11n and YOLOv11s models, as well as fluorescent nuclei detector YOLOv5n are downloaded automatically with pip install napari-nuclephaser. To use larger models, download them with these links:

Expand Down Expand Up @@ -135,7 +135,7 @@ napari-nuclephaser plugin offers following widgets:

Learn more about widgets and their functionality at [documentation](https://napari-nuclephaser.readthedocs.io/en/latest/index.html).

# Citation
## Citation
If you use NuclePhaser in your work, please cite our preprint:
```bibtex
@article {Voloshin2025.05.13.653705,
Expand All @@ -149,7 +149,7 @@ If you use NuclePhaser in your work, please cite our preprint:
}
```

# Installation
## Installation

For detailed installation instructions, visit our [documentation](https://napari-nuclephaser.readthedocs.io/en/latest/Installation/Installation.html).

Expand Down