Latest update - Jan 2025
Thomas O'Neil (thomas.oneil@sydney.edu.au) | Oscar Dong (oscardong4@gmail.com) | Heeva Baharlou
The purpose of this notebook is to provide a consolidated approach to IMC analysis and forms the prerequisite steps to the IMComplete R package workflow. We focused
Nature Method of the Year in 2024 was spatial proteomics.
Computational tools for spatial proteomics are the focus of the second Comment, from Yuval Bussi and Leeat Keren. These authors note that current image processing and analysis workflow are well defined but fragmented, with various steps happening back to back rather than in an integrated fashion. They envision a future for the field where image processing and analysis steps work in concert for improved biological discovery.
In alignment with these comments, we have committed to provide a comprehensive and dynamic workflow. In part, we aimed to achieve this by compiling as much as we could into this pre-processing workflow.
Particularly, we have emphasised tools that can be performed in one linear workflow. For example, we provide the function PyProfiler
, a tool that performs the same functions as CellProfiler in extracting cell features, and RegisterImages
to register IMC to IF in Python, and allowing users remain in this linear pipeline and not have to install additional applications.
Some scripts adapted from BodenmillerGroup/ImcSegmentationPipeline
Therefore, make sure to also reference these studies:
- Windhager, J., Zanotelli, V.R.T., Schulz, D. et al. An end-to-end workflow for multiplexed image processing and analysis. Nat Protoc (2023).
ImagingAnalysis/ (root directory)
├── IMComplete-Workflow
├── ImcSegmentationPipeline
├── Experiment_name_1
│ └── raw
│ └── Sample1.zip
│ └── Sample2.zip
│ └── ...
│ └── analysis
│ └── 1_image_out
│ └── 2_cleaned
│ └── 3_segmentation
│ └── 3a_cellpose_crop
│ └── 3b_cellpose_full
│ └── 3c_cellpose_mask
│ └── 3d_compartments
│ └── 4_pyprofiler_output
│ └── panel.csv
├── ...
├── Experiment_name_n
Anaconda is needed to run this workflow. Follow the steps below to set up Anaconda and a conda
environment:
Install Anaconda and navigate to the relevant command line interface:
Windows | macOS |
---|---|
1. Search for 'Anaconda Prompt' in the taskbar search 2. Select Anaconda Prompt |
1. Use cmd + space to open Spotlight Search 2. Type 'Terminal' and press return to open |
cd /Desktop/ImageAnalysis
From Github
Go to the Github page and near the top click the code
button and download the zip. Unzip the folder into the root
directory. This will contain the IMComplete-Workflow documents and allow ready access to the necessary files.
Using Git in command line
git clone --recursive https://github.com/CVR-MucosalImmunology/IMComplete-Workflow.git
- BodenmillerGroup/ImcSegmentationPipeline: Windhager, J., Zanotelli, V.R.T., Schulz, D. et al. An end-to-end workflow for multiplexed image processing and analysis. Nat Protoc (2023).
git clone --recursive https://github.com/BodenmillerGroup/ImcSegmentationPipeline.git
conda env create -f IMComplete-Workflow/environment.yml
This can take some time so be patient!
conda activate IMComplete
Unfortunately, parts of this workflow will require GPU-acceleration: Cell segmentation, Denoise, PyProfiler (will run quicker, but not necessary).
You will need to install Pytorch and pytorch-cuda versions that are suitable for your PC. Instructions are found here. The code will look like this:
conda install pytorch==2.4.1 torchvision==0.19.1 torchaudio==2.4.1 pytorch-cuda=12.4 -c pytorch -c nvidia
Cellpose is used for cell segmentation. We'll install the gui version for the user-friendly version. If you experience errors installing cellpose, refer to the cellpose installation instructions
python -m pip install cellpose[gui]
-
Set up (
CheckSetup()
) -
Create a new project (
NewProject()
) -
Prep the raw folder and
panel.csv
-
Extract images from the raw folder (
ExtractImages()
)
-
Optional 1: Check filter parameters of IF data (
CheckExtract()
) -
Optional 2: Filter images (
FilterImages()
) -
Optional 3: Select crop regions for segmentation training (
CropSelector()
)
- Prepare the images for Segmentation model training (
PrepCellpose()
)
- Optional 4: Register low-resolution images with high-resolution images to improve cell segmentation (
RegisterImages()
)
- Train a segmentation model (
cellpose
)
- Optional 5: You have the option to not train a segmentation model and use a generic model.
-
Batch segment the images and generate cell masks (
BatchSegment()
) -
Extract data from your images using the cell segment masks (
PyProfiler()
)