Skip to content

A simple python script to automatically obtain the circular area of an organoid blob.

Notifications You must be signed in to change notification settings

patherlkd/OrganoidBlobSize

Repository files navigation

OrganoidBlobSize

A python toolkit to automatically compute the size (area) of an organoid center. Code was written by Dr. Luke Davis.

All images provided were produced by Nathasia Muwanigwa (https://wwwen.uni.lu/lcsb/people/nathasia_muwanigwa) and are not to be used for commercial purposes and permission must be granted by Nathasia Muwanigwa before any image can be reproduced elsewhere.

The rest of the repository (that isn't an image) is under CC-BY-SA 2.0 https://creativecommons.org/licenses/by-sa/2.0/.

(This was done as an extra-curricular venture, this works as is. Please do play around with the blob criteria to further "refine" the areas.)

System Requirements

This code relies only on python3 (version 3.6.9). Please install python3 (free) on your system (Windows, Linux, Mac). The code was tested on Ubuntu linux 18 LTS and Windows 10.

Python3 packages to install:

For windows (10) users follow these instructions for installing:

  • Install python3 from the Microsoft Store for free. If you open the command prompt and type python3 (then the return key) it should take you to the microsoft store.
  • Install pip3 from the Microsoft Store for free. Again try to type pip3 on the command prompt and it should take you to the microsoft store.

Once you can run python3 and pip3 from the command prompt you are ready to install the relevant python packages.

  • Open the command prompt
  • Install Numpy by typing pip3 install numpy and then press the return key.
  • Install alphashapes by typing pip3 install alphashape and then press the return key.
  • Install matplotlib by typing pip3 install matplotlib and then press the return key.
  • Install Pillow by typing pip3 install Pillow and then press the return key.
  • Install opencv-python (cv2) pip3 install opencv-python and then press the return key.

How to use the script

First we need images. Place your organoid blob images in the folder images. Ensure that each image is as you would expect and they all share the same area per pixel (and ideally size). The code works on all the images present in the images folder, so ensure you only put in the images you want to analyse. The file names can be whatever, the code preserves these.

An image could look like:

organoid

By running the program (right clicking Example_workflow.py then running with python3 or running on the command line as python3 Example_workflow.py) you will first see that the program filters the images (Gaussian or Median filter e.g.). The filtered images are shown in filtered_images folder.

Our example image above, when filtered looks like

filtered organoid

The program then attempts to find a circle that fits the blob. Such a circle could look like

circled_organoid

The program computes the area of the circle which, with suitable blob criteria, should well approximate the area of the blob. The area is saved in units specified from the area per pixel variable in Example_workflow.py. The areas are saved in the data folder.

Example_workflow.py

The main code for this problem, to refine the areas you only need to edit this code.

Supporting and other useful codes

These codes should be present in the same folder as Example_workflow.py but, if you don't know what you are doing, you shouldn't edit them.

py_image_LD.py

Main supporting code. Contains functions to manipulate and probe the images.

cluster.py

Contains the functions to cluster and segment objects, could be useful for further enhancements/problems.

About

A simple python script to automatically obtain the circular area of an organoid blob.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages