Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Cellpose For Aivia

Cellpose Information

This Aivia python recipe applies the Cellpose deep learning model to generate segmentation for cells/nucleus in 2D or 3D images.

Online information about Cellpose are listed below:

Important note: If you use this plugin, please cite the original research paper: https://www.nature.com/articles/s41592-020-01018-x

Requirements

  • Virtual Environment for Cellpose - the required virtual environment will be created automatically when you run CellposeForAivia.py for the first time. All required python packages will be installed in this virtual environment. You can check the requirements.txt to see what packages will be installed.
  • Python 3.12 - comes with Aivia
  • Accept the risks that come from running Python Scripts you download from the internet. These Cellpose scripts are provided to you to use at your own risk. Note that they may download models and/or related files from GitHub directly, which could be a security risk.

Installation

  1. Make sure Git is installed on your machine, the Cellpose scripts may need to download from the official Cellpose GitHub.
  2. Download the whole CellposeVenv folder. Since GitHub does not support subfolder download, we zipped the folder here for you: CellposeVenv.zip.
  3. Unzip the the downloaded folder CellposeVenv. The tree structure of the folder is as follow
  CellposeVenv
  ├───CellposeForAivia.py
  ├───requirements.txt
  ├───README.md
  └───Data
      └───Cellpose_venv.py

Execution

  1. Load CellposeForAivia.py onto Aivia by "File>Open" or drag-and-drop

  2. Load a target image onto Aivia

  3. In Aivia analysis tools, adjust input, output, and processing parameters.

  4. Click on "Start" button and wait for the result

    1. Please make sure that you have the Internet connection and wait longer for the first execution. When you run the recipe for the first time, the required virtual environment, env, will be created under Cellpose_venv. Python packages used by Cellpose will be downloaded and installed in the enironment.

Parameters

  • Pre-Processing Deep Learning Model : aiviadl

    • You can select an Aivia-shipped model here for pre-processing. Please leave it as "None" if you only want to use Cellpose. You can also make your own model, or load your own model and convert to aiviadl. Examples of useful models could be an enhancment, cleaning, or conversion type model. Usually it is left blank.
  • Input Image : Aivia channel

    • Input channel to segment.
  • Diameter (px) : double

    • Approximate size of the structures you wish to segment (in pixels), must greater than zero.
  • Model Type (0=cyto, 1=nuc) : int (bool)

    • Boolean to determine which Cellpose model you wish to run.
      • 0 : Choose the cytoplasm model (segment the whole cell).
      • 1 : Choose the nuclei model
  • Mask Threshold : double, default is 0.0, range from -6.0 to 6.0

    Also known as Cell Probability Threshold in earlier version of Cellpose. The pixels greater than the mask threshold are used to run dynamics and determine masks. The predictions the network makes of the probability are the inputs to a sigmoid centered at zero (1 / (1 + e^-x)), so they vary from around -6 to +6. The default is mask_threshold=0.0.

  • Flow Threshold : double, suggested default is 0.4

    The Flow Threshold is the maximum allowed error of the flows for each mask. Increase this threshold if cellpose is not returning as many masks as expected.

Returns

  • Mask : Aivia channel
    • The labeled segmentation mask generated by applying the Cellpose model. Note: if labels are touching each other, please contact us, we will send you an Aivia recipe that allows you to generate objects from the touching labels.
  • Confidence Map : Aivia channel
    • Cell probability generated by applying the Cellpose model.

Archived Version (Not supported by the latest version of Aivia)

For tracking only, please follow the Installation section to use the latest version of Cellpose_venv.

Important: The following archived versions of Cellpose_venv contain a pre-created virtual environment which may not work on your system.

  1. Cellpose_virtualEnvironment_0031.zip. Add Cell Probability Threshold and Flow Threshold

  2. Cellpose_virtualEnvironment.zip. First version