GithubHelp home page GithubHelp logo

aimat-lab / microdroplet_segmentation Goto Github PK

View Code? Open in Web Editor NEW
1.0 0.0 0.0 7.48 MB

Segmentation for microdroplet arrays used in screening experiments.

License: MIT License

Batchfile 0.24% Python 99.76%

microdroplet_segmentation's Introduction

Micro-droplet Segmentation in Microscopy Images

Semi-supervised tool for segmentation of micro-droplet arrays in microscopy images. This data analysis tool was developed to automatically detect and evaluate droplet stained by fluorescence markers.

Requirements

Required packages for this project can be installed with pip and are listed below. The GUI uses matplotlib and image processing is handled by opencv and skimage. The code is tested on Windows machines to run on lab computers, where python is available in system PATH environment variable!

python -m pip install opencv-python
python -m pip install openpyxl
python -m pip install matplotlib
python -m pip install scikit-image

Implementation details

The main program of main.py, executed with RUN.bat or python main.py runs over all images in "input/" folder and creates an equally named output folder in "output/". For each image a series of individual python modules is called, which can also be used independently but may require input from the previous module. Modules are ImageSelection.py, FindScaleBar.py, GridSegmentation.py and DropletSeparation.py. General-use classes are given in grid.py and image.py. Each module opens a "Qt5Cairo" interactive backend of matplotlib. Press "enter" to accept and continue.

Usage

With main.py the sequence of the following scripts is executed for each image in ./input . Note that the scripts may require output from the previous script. To accept and continue to the next step press 'enter'. Interactive help and key bindings is usually plotted on the left.

FindScaleBar.py

First is an optional scale bar information. If the scale bar is detected properly, you can accept its value with 'a'. The information is stored in 'ScaleBar.yaml'. The detection algorithm is a hard-coded simple search routine.

plot

ImageSelection.py

The image selection allows to remove some boundaries and to pick an image selection and to rotate the image if the image was not aligned. To decide on a selection you can choose the magnifying class from the menu. Rotation can be done with arrow keys. Increasing brightness and contrast is only for show, but does not alter image information. With 'g' you can activate grid lines to guide the eye.

plot

GridSegmentation.py

With this module the grid is adjusted to the data. The auto grid should be already quite good. You can reproduce the auto-grid with 'r'. A simple uniform standard grid can be generated with 'n' in case the auto-grid fails completely. You can add/remove grid rows/columns with 'i,j,k,l'. Change between add and remove with 'u'. When clicking at the grid lines you can change the origin marked as green. You can lock/unlock this by pressing 'm'. The grid is stretched with 'w,a,s,d' around the origin. You can move the grid with arrow keys. Removing rows/columns at the origin should not cause an error, just shift the origin to its proper position. Note that this is not an infinite grid, so the 0th position for row/column is well-defined.

plot

DropletSeparation.py

Lastly the droplets are detected and their size and intensity recorded. For edge detection, a sobel filter with median and gaussian blurring from scikit-image is used. After droplet segmentation with a two-label watershed algorithm within each array box on the sobel elevation map, the pixel size and integrated gray-scale intensities of each droplet are recorded. Note that dependent on the image size only a preview image is shown with reduced resolution. But when you are satisfied with the settings you can render at full resolution with 'r'. You can modify the default parameters of the detection algorithm. You can select the parameter with '1,2,3,...' and the parameter is given in the title or the log on the right. You can change the value with keys up/down. You can print current (mean) settings with 'm'. When your cursor is in the grid you can change this individual cells or for all cells if the cursor is outside the image. Individual changes are only intended to for example lift the detection threshold, if the droplet is just not bright or big enough. However, changes in the parameter should be applied with care and only if really necessary, since this may affect the overall size of the detected droplets between images and therefore cause inconsistencies in the total dataset. However, the GUI can be used to find good default parameters in the first place. You can then change the default parameters in configs/DropletSeparation.yaml. If a scale bar was found, the droplet size is scaled to by the scale bar length in "DropletsSizeScaled.xlsx". Changing the brightness only affects the displayed image but not the algorithm or the image data.

plot

Citing

If you want to cite this repo, please refer to our articles 1 or 2.

@article{https://doi.org/10.1002/smtd.202300553,
author = {Seifermann, Maximilian and Reiser, Patrick and Friederich, Pascal and Levkin, Pavel A.},
title = {High-Throughput Synthesis and Machine Learning Assisted Design of Photodegradable Hydrogels},
journal = {Small Methods},
volume = {n/a},
number = {n/a},
pages = {2300553},
doi = {https://doi.org/10.1002/smtd.202300553},
url = {https://onlinelibrary.wiley.com/doi/abs/10.1002/smtd.202300553}
}
@article{https://doi.org/10.1002/admi.202300227,
author = {Iwohn, Michelle J. and Seifermann, Maximilian and Reiser, Patrick and Höpfner, Julius and El Khaled El Faraj, Razan and Heißler, Stefan and Popova, Anna A. and Levkin, Pavel A.},
title = {OligoHydrogelArray (OHA) for Parallelized Solid-Phase Extraction of Oligonucleotides},
journal = {Advanced Materials Interfaces},
volume = {n/a},
number = {n/a},
pages = {2300227},
doi = {https://doi.org/10.1002/admi.202300227},
url = {https://onlinelibrary.wiley.com/doi/abs/10.1002/admi.202300227},
}

microdroplet_segmentation's People

Contributors

patreis avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.