Skip to main content

Plugin for cell segmentation in 3D

Project description

CellSeg3D: self-supervised (and supervised) 3D cell segmentation

cellseg3d logo

Code style: black PyPI Downloads Downloads License: MIT Python Version codecov napari hub

  • A napari plugin for 3D cell segmentation: training, inference, and data review. In particular, this project was developed for analysis of mesoSPIM-acquired (cleared tissue + lightsheet) datasets.

demo

Installation

💻 See the Installation page in the documentation for detailed instructions.

Documentation

📚 A lot of documentation is available at https://AdaptiveMotorControlLab.github.io/CellSeg3D

You can also generate docs by running make html in the docs/ folder.

Quick Start

To use the plugin, please run:

napari

Then go into Plugins > napari-cellseg3d, and choose which tool to use.

  • Review (label): This module allows you to review your labels, from predictions or manual labeling, and correct them if needed. It then saves the status of each file in a csv, for easier monitoring.
  • Inference: This module allows you to use pre-trained segmentation algorithms on volumes to automatically label cells and compute statistics.
  • Train: This module allows you to train segmentation algorithms from labeled volumes.
  • Utilities: This module allows you to perform several actions like cropping your volumes and labels dynamically, by selecting a fixed size volume and moving it around the image; fragment images into smaller cubes for training; or converting labels from instance to segmentation and the opposite.

News

New version : v0.2.0

  • Changed project name to "napari_cellseg3d" to avoid setuptools deprecation
  • Small API changes for training/inference from a script
  • Some fixes to WandB integration ad csv saving after training

Previous additions :

  • v0.1.2 :Fixed manifest issue for PyPi
  • Improved training interface
  • Unsupervised model : WNet3D
    • Generate labels directly from raw data!
    • Can be trained in napari directly or in Google Colab
    • Pretrained weights for mesoSPIM whole-brain cell segmentation
  • WandB support (install wandb and login to use automatically when training)
  • Remade and improved documentation
    • Moved to Jupyter Book
    • Dedicated installation page, and working ARM64 install for macOS Silicon users
  • New utilities
  • Many small improvements and many bug fixes

Install note for ARM64 (Silicon) Mac users

To avoid issues when installing on the ARM64 architecture, please follow these steps.

  1. Create a new conda env using the provided conda/napari_CellSeg3D_ARM64.yml file :

     git clone https://github.com/AdaptiveMotorControlLab/CellSeg3d.git
     cd CellSeg3d
     conda env create -f conda/CellSeg3D_ARM64.yml
     conda activate napari_CellSeg3D_ARM64
    
  2. Install a Qt backend (PySide or PyQt5)

  3. Launch napari, the plugin should be available in the plugins menu.

Requirements

Python 3.8 or 3.9 required. Requires napari, PyTorch and MONAI. Compatible with Windows, MacOS and Linux. Installation should not take more than 30 minutes, depending on your internet connection.

For PyTorch, please see the PyTorch website for installation instructions.

A CUDA-capable GPU is not needed but very strongly recommended, especially for training.

If you get errors from MONAI regarding missing readers, please see MONAI's optional dependencies page for instructions on getting the readers required by your images.

Quick demo

After installation, you can run the plugin by running:

    napari

and launching the plugin from the Plugins menu. You may use the test volume in the examples folder to test the inference and review tools. This should run in far less than five minutes on a modern computer.

You may also find a demo Colab notebook in the notebooks folder.

Issues

Help us make the code better by reporting issues and adding your feature requests!

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

Testing

Before testing, install all requirements using pip install napari-cellseg3d[test].

pydensecrf is also required for testing.

To run tests locally:

  • Locally : run pytest in the plugin folder
  • Locally with coverage : In the plugin folder, run coverage run --source=napari_cellseg3d -m pytest then coverage xml to generate a .xml coverage file.
  • With tox : run tox in the plugin folder (will simulate tests with several python and OS configs, requires substantial storage space)

Contributing

Contributions are very welcome.

Please ensure the coverage at least stays the same before you submit a pull request.

For local installation from Github cloning, please run:

pip install -e .

License

Distributed under the terms of the MIT license.

"napari-cellseg3d" is free and open source software.

Acknowledgements

This plugin was developed by originally Cyril Achard, Maxime Vidal, Mackenzie Mathis. This work was funded, in part, from the Wyss Center to the Mathis Laboratory of Adaptive Intelligence. Please refer to the documentation for full acknowledgements.

Plugin base

This napari plugin was generated with Cookiecutter using @napari's cookiecutter-napari-plugin template.

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_cellseg3d-0.2.0.tar.gz (652.7 kB view details)

Uploaded Source

Built Distribution

napari_cellseg3d-0.2.0-py3-none-any.whl (676.6 kB view details)

Uploaded Python 3

File details

Details for the file napari_cellseg3d-0.2.0.tar.gz.

File metadata

  • Download URL: napari_cellseg3d-0.2.0.tar.gz
  • Upload date:
  • Size: 652.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for napari_cellseg3d-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7b14ebb3c04d2d256a3bef5080c0329163af9d5c85e07b2c76f921a25c6c5086
MD5 730741a2bb867338afb78f765576de69
BLAKE2b-256 ba973abad4dc74a34eb274fe415a378631023fd13cb3b3471d725aae164071eb

See more details on using hashes here.

File details

Details for the file napari_cellseg3d-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for napari_cellseg3d-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 49d5ac4ce300cf778b0349a357fac3527f08c242228a1a0bf3813d7410b3c162
MD5 1ead3b1a1b6b3b72502892a1afe84261
BLAKE2b-256 3da05ac23a453f472c719886fee9efbccb2e75db3a59417bd994980f13b617b3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page