The package uses deep learning to detect M. tuberculosis growth in 96-well microtiter plates and determines **Minimum Inhibitory Concentrations (MICs)**.
Project description
TB Microbial Analysis System (TMAS)
Overview
The package uses deep learning to detect M. tuberculosis growth in 96-well microtiter plates and determines Minimum Inhibitory Concentrations (MICs).
Features
- Data Preprocessing: Plate images are preprocessed by applying various image processing techniques: Mean Shift Filter, Contrast-Limited Adaptive Histogram Equalization filter (CLAHE), and Pixel histogram normalisation. The images are then resized and padded to fit the detection model’s input.
- Growth Detecting: A pre-trained deep learning model (YOLOv8) is used to detect the bacterial growth in each well of the plate.
- Plate output analysis: The detection output is analysed to ensure bacterial growth in control wells, which are drug-free, to validate the experimental conditions.
- MIC Mapping: Match the detected growths with the dilution and concentration matrix of each drug to extract Minimum Inhibitory Concentrations (MICs) corresponding to a specific plate design.
Installation
Installation - Python Package
-
Install the Python package from PyPi
$ pip install tmas==1.0.2
-
Run
TMASon your Terminal$ run_tmas [folder_path] [output_format]
-
folder_path: The direct path to the folder of the raw images
-
output_format: output MIC of each drug in
csvorjsonfile (default format iscsv)or
$ run_tmas [file_path] [output_format]
-
file_path: The path to the raw image
-
output_format: output MIC of each drug in
csvorjsonfile (default format iscsv) -
NOTE: Make sure your
file_pathends with -raw.png
Installation - GitHub
-
Clone the repository and navigate to the project directory.
$ git clone https://github.com/Oucru-Innovations/tmas.git $ cd tmas
-
Install the
TMASpackage using:$ pip install -e .
This may take a while if those packages are not available in the current environment. The internet connection and the hardware capacity also affect the installation speed.
-
Run
TMAS:$ run_tmas [file_path] [output_format]
-
file_path: the direct path to the raw image
-
output_format: output MIC of each drug in
csvorjsonfile (default format iscsv) -
NOTE: Make sure your
file_pathends with -raw.pngor
$ run_tmas [folder_path] [output_format]
- folder_path: The path to the folder of the raw images
- output_format: output MIC of each drug in
csvorjsonfile (default format iscsv)
If encounting any error in Installing the packages, please refer to the Debugging section.
Tutorial
-
Explore the examples folder
$ cd data $ ls 1/ 2/ 3/ 4/ 5/
In each examples folder, there is a raw iamge
$ ls 1/ 01-DR0013-DR0013-1-14-UKMYC6-raw.png
-
To process and analyse a single image using the default settings is simply
Choose your desired MIC output file:
json
- To run only one image:
$ run_tmas data/1/01-DR0013-DR0013-1-14-UKMYC6-raw.png json
- To run the whole folder:
$ run_tmas data/1 json
csv
- To run only one image:
$ run_tmas data/1/01-DR0013-DR0013-1-14-UKMYC6-raw.png csv
- To run the whole folder:
$ run_tmas data/1 csv
-
Growth detection output:
-
Output files: After
TMAShas done running, the growth detection and MIC results will be displayed in your terminal.Not only that, the growth detection image and the MIC results file with the chosen format will be saved in the same folder with the input image.
$ ls -a 1/ output/ 01-DR0013-DR0013-1-14-UKMYC6-raw.png $ ls -a 1/output/ 01-DR0013-DR0013-1-14-UKMYC6-growth-matrix.png 01-DR0013-DR0013-1-14-UKMYC6-mics.csv 01-DR0013-DR0013-1-14-UKMYC6-mics.json 01-DR0013-DR0013-1-14-UKMYC6-filtered.png
01-DR0013-DR0013-1-14-UKMYC6-raw.pngis the original image.01-DR0013-DR0013-1-14-UKMYC6-filered.pngis the filtered image after preprocessing.01-DR0013-DR0013-1-14-UKMYC6-growth-matrix.pngis the image with the growth detection plotted.01-DR0013-DR0013-1-14-UKMYC6-mics.csvcontains the information, including filename, drug name, growth detection results, MIC result.01-DR0013-DR0013-1-14-UKMYC6-mics.jsoncontains the same information as thecsvfile but in a different format per requested.
To see the other options available for the run_tmas python script:
$ run_tmas --help
usage: run_tmas [-h] [-visualize] path [{csv,json}]
Run TMAS for image processing, growth detection, and MIC analysis.
positional arguments:
path Path to the image or directory containing images.
{csv,json} Format type for saving results: 'csv' or 'json'.
optional arguments:
-h, --help Show this help message and exit
-visualize, --visualize
Display images with growth detection results.
Debugging
- If you encounter an error in Step 2 (unable to download any package), you can try creating a new environment and continue with the installation code:
-
Set Up a New Virtual Environment
$ conda create -n tmas_env python=3.9 $ conda activate tmas_env
-
Clone the repository and navigate to the project directory.
$ git clone https://github.com/Oucru-Innovations/tmas.git $ cd tmas
-
Install the package using:
$ pip install -e .
This may take a while if those packages are not available in the current environment. The internet connection and the hardware capacity also affect the installation speed.
-
Run
TMAS:$ run_tmas [folder_path] [output_format]
- folder_path: the folder contains the image
- output_format: output MIC of each drug in csv or json file
- Example: please refer to
Tutorial Session
If you finished installing TMAS package but run_tmas direct you to your github path, you can try creating a virtual environment and try installing the package again:
-
Set Up a New Virtual Environment
$ conda create -n tmas_env python=3.9 $ conda activate tmas_env
-
Install
TMASpackage:pip install tmas==1.0.1
-
Run
TMAS:run_tmas [folder_path] [output_format]
- folder_path: The path to the folder of the raw images
- output_format: output MIC of each drug in
csvorjsonfile (default format iscsv)
License
TMAS was created by RMIT 2OO2 TEAM. It is licensed under the terms of the MIT license.
Credits
TMAS was created with cookiecutter and the py-pkgs-cookiecutter template.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tmas-1.0.2.tar.gz.
File metadata
- Download URL: tmas-1.0.2.tar.gz
- Upload date:
- Size: 15.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d1ed121d1abe1bcc2912b2854caa0322cd4d17a5ebf3da4b1d6ebe8e5b84285e
|
|
| MD5 |
790024a8e29b61885bc08b8ff99eb5cd
|
|
| BLAKE2b-256 |
d2022e2b209badc65f3d903b7640e3d62c66acbf3d7c0c532082afe919fa11e9
|
File details
Details for the file tmas-1.0.2-py3-none-any.whl.
File metadata
- Download URL: tmas-1.0.2-py3-none-any.whl
- Upload date:
- Size: 15.4 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e05ae068b278ad5b48a749fda1dea9fb0f6bc0e711f8c430fa0e2f08fa3f4d4e
|
|
| MD5 |
322b0a5eda3f6662580671331d1ee785
|
|
| BLAKE2b-256 |
4d8cd880f7471fbd29421b3226cb6f23449ece2176cf053078d625b39e19b29a
|