Immune Cell Segmentation & Shape Analysis is an open-source Snakemake workflow that allows analysis of cell shapes after segmentation using user defined pytorch models.
- Install miniconda following the installation instructions.
- Start the Anaconda Prompt.
- Navigate to the analysis folder
cd path/to/folder. - Create the python environment and install the required packages by calling:
conda env create -f environment_gpu.ymlfor the prefered GPU versionconda env create -f environment.ymlfor CPU version1.
- Merge images of different markers from the same image section into one TIFF file, formated as CYX with named channels as C.
- Insert the merged images into the input folder.
- Adjust parameters in the config/config.yml file.
- Declare cell marker channel names under "target" as a list.
- Declare the DAPI channel name under "registration".
- Under "ml_segmentation" declare an input with the same name as in target for each target marker and define the model_name, config, checkpoint and a cutoff_value. (model_name "default" will result in using a pretrained model)
- Open a Terminal application and navigate to the folder
- Activate the python environment with
conda activate immune_gpu(or immune for CPU) - Type
snakemake -c all --snakefile ./workflow/Snakefile.
| Rule | Output |
|---|---|
| Top Hat | Contrast stretched and white tophat image |
| DAPI Segmentation | Cellpose segmentation of DAPI channels for registration |
| Otsu Segmentation | Otsu segmentation of marker images for model training |
| ML Segmentation | Deep learning model segmentation of marker images for shape analysis |
| Registration | Registering all segmented marker images with dilated DAPI |
| Skeletonization | Skeletonizing DAPI positive marker images |
| Branch Counter | Counts branches, endpoints and branchpoints of skeletonized images |
| Longest Path | Determines the length of the direct path between the two endpoints with the highest eccentricity of skeletonized images |
| Cell area | Determines the number of pixels of registered markers |
| Nearest Neighbor | Computes the distance to the nearest neighbor and number of neighbors in set distances for cells in the registered image |
Prof. Dr. Daniel R. Engel: Department of Immunodynamics, Institute of Experimental Immunology and Imaging, University Hospital Essen, Essen, Germany http://www.immunodynamics.de
Dr. Jianxu Chen: Leibniz-Institut für Analytische Wissenschaften-ISAS-e.V., Dortmund, Germany.
Footnotes
-
Using the CPU will result in a considerable slowdown of the machine learning segmentation step. ↩