Instance Segmentation of Intestinal organoids and Spheroids from BrightField images using YOLOv8 (ISIS-BF-YOLO)
This repository contains a number of tools to speed up the interpretation of images from intestinal organoids acquired using a widefield microscope (brightfield illumination). In our case an EVOS M7000 multiwell scanner which outputs the following filenames: P1_Plate_M_p00_z00_0_A01f00d0.
-
This tool uses the previously mentioned naming convention to extract the well_id from each image ("A01"), scan through all z-planes ("z00") and perform a minimum intensity projection.
-
Based on said projections a previously trained YOLOv8 model predicts instances of 3 classes of intestinal organoids: differentiated organoids, spheroids and dead/overgrown organoids.
-
It extracts counts of each object on a per class basis and morphology measurements such as area, perimeter, circularity and solidity.
-
Finally it generates two plate views of the entire multiwell plate at high resolution for data exploration (minimum intensity projection and segmentation). Filenames must contain the well_id identifier in order for the scripts to work and plot the plate views.
-
In order to run these Jupyter notebooks you will need to familiarize yourself with the use of Python virtual environments using Mamba. See instructions here.
-
Then you will need to create a virtual environment (venv) either using the following command or recreate the environment from the .yml file you can find in the envs folder:
mamba create -n int_organoids python=3.9 devbio-napari cellpose pytorch torchvision plotly pyqt ultralytics python-kaleido -c conda-forge -c pytorch
-
To recreate the venv from the environment.yml file stored in the envs folder (recommended) navigate into the envs folder using
cd
in your console and then execute:mamba env create -f environment.yml
-
(optional) If you want to automatically save the resulting .png graphs install kaleido in the venv using pip:
mamba activate int_organoids
pip install kaleido
-
Once your virtual environment is ready you can copy all your folders containing the images from EVOS inside the data directory using the following structure:
intestinal_organoid_YOLOv8/ #Primary data folder for the project ├── data/ #All input data is stored here. │ ├── Plate_01/ │ │ ├── P1_Plate_M_p00_z00_0_A01f00d0.TIF │ │ ├── P1_Plate_M_p00_z01_0_A01f00d0.TIF │ │ └── ... │ ├── Plate_02/ │ │ ├── P2_Plate_M_p00_z00_0_A01f00d0.TIF │ │ ├── P2_Plate_M_p00_z01_0_A01f00d0.TIF │ │ └── ... │ └── ...
-
The easiest way to interact with the analysis code is via Jupyter Lab. To launch a jupyter lab server run the following commands:
mamba activate int_organoids
jupyter lab
-
Open 1_image_analysis.ipynb, define your username and desired resolution for the output plates and run all the cells.
-
You will find all the results under
.output/USERNAME
, to explore the extracted stats run 2_image_analysis.ipynb.