Skip to content

amphybio/endomicroscopy-analysis

Repository files navigation

Motiro

GitHub last commit GitHub issues GitHub pull requests GitHub

Motiro - from tupi-guarani, the language of native Brazilians, meaning a reunion for building - is an unified non-supervised Python-based framework for pre-processing, segmentation, quantitative and statistical analysis of the architecture of the colorectal mucosa imaged by probe-based Confocal Laser Endomicroscopy (pCLE) and, hence, a useful tool for feeding an integrated database.

Table of contents

Dependencies

(Back to top)

Motiro supports Python 3.6+ and runs on a Linux Operational System. Use the 'requirements.txt' file to install all packages dependencies. The mosaic function needs ImageJ/Fiji program with Register Virtual Stack Slices plugin.

Installation

(Back to top)

Download the file and unzip it. Go to the directory where there is the 'requirements.txt' file and run:

user@term:~$ pip install -r requirements.txt

to install the dependencies. After this step, the application will be ready to use.

Usage

(Back to top)

The folder application has the following structure:

.
├── application                 # Application modules (Python files)
├── data-sample                 # Sample files
│   ├── comparative-sample
│   │   ├── main
│   │   │   ├── Sample01        # First patient sample
│   │   │   .   ├── 0           # pCLE videos that will be used as reference
│   │   │   .   └── 1           # pCLE videos to be compared
│   │   │   .
│   │   │   └── SampleNN        # i-th patient sample
│   │   │       ├── 0
│   │   │       └── 1
│   │   └── sandbox             # Store backup directories to avoid overwriting
│   └── characterization-sample
│       ├── main
│       │   ├── Sample01
│       │   .   ├── 0
│       │   .   └── 1
│       │   .
│       │   └── SampleNN
│       └── sandbox
├── requirements.txt            # Lists all of a program's dependencies
├── LICENSE                     # Code license
└── README.md

application directory contains the Python modules. The module extract.py performs the image analysis in the input files. To see the quick options of this module run:

user@term:~$ python extract.py -h

The command will show the information summarized in the table below:

Arguments Description
-h, --help Show help message and exit
-f, --function Set a function to call
-p, --path Set input file or directory path
-v, --verbose Increase log output verbosity
-s, --settings Settings the input file format

The arguments -f and -p are mandatory to perform the analysis. The functions available are:

Function Description
comparative Generate the image frames, pixel intensity and fractal dimension data

The module investigation.py performs the statistical analysis of the results generated with the previous module. To see the quick options of this module run:

user@term:~$ python investigation.py -h

The command will show the information summarized in the table below:

Arguments Description
-h, --help Show help message and exit
-f, --function Set a function to call
-p, --path Set input file or directory path
-v, --verbose Increase log output verbosity

The arguments -f and -p are mandatory to perform the analysis. The functions available are:

Function Description
comparative-analysis Generate the pixel intensity, fractal dimension and Hellinger distance histograms and the pixel intensity and fractal dimension Q-Q plots

The rvss.py and logendo.* files are used to set the configurations to stitch images in mosaic and logging, respectively.

In data-sample there are some input samples for compartive analysis and statistical characterization. Inside of each directory of the classes of analysis there are the directories 'main' and 'sandbox'. The main directory is where the files that will be analysed shall be placed while the sandbox will save directories that can be overwritten during the program are running.

For the comparative analysis, each subdirectory in main represent a patient sample, and the reference healthy videos of a patient must be placed in the subdirectory 0 while the videos to be compared must be placed in 1.

Comparative analysis of healthy and tumor mucosa

1. Frames, pixel intensity and fractal dimension data

First step to perform the comparative analysis is generate the frame images from pCLE videos to produce the pixel intensity and fractal dimension data. The command below is an example to carry out this steps:

user@term:~$ python extract.py -f comparative -p ../data-sample/comparative-sample/main/

Videos with MP4 and MPEG extensions will be listed by default, if different format is needed the optional argument -s can be used to specify the format as follow:

user@term:~$ python extract.py -f comparative -p ../data-sample/comparative-sample/main/ -s .avi .mkv

In this example, just videos with AVI and MKV extensions will be listed. A list of extensions can be set to search files, is necessary only separate each extension with a simple space after -s argument.

The output of this execution will generate the frame folder whereby for each video input, a folder with frame images named with the video name will be created. Furthermore, CSV files with the fractal dimension values and other with pixel intensity of each frame will be produced for each video.

The plots outside the frame folder use all frames from all videos of the patient to generate a global statistics of the patient.

2. Generate statistics

After perform the data generation in the previous step, to produce the statistical analysis and the plots, run the following command:

user@term:~$ python investigation.py -f comparative-analysis -p ../data-sample/comparative-sample/main/

This command will use the videos in the reference folder (folder named as 0/) for each patient to generate the comparison with the videos in folder 1/. For each video will be produce a pixel intensity histogram plot and the Q-Q plot of pixel intensity as well the distribution histogram and the Q-Q plot of the fractal dimension will be produced. The Hellinger distance will be calculated and a histogram plot of the distribution of distances will be generated. For each video, the related graph starts with the video name followed by the plot type. (i.e, S01V01-fractal-qq-plot.png)

Statistical characterization of the architecture of the healthy colorectal mucosa

License

(Back to top)

GNU General Public License version 3

About

A unified non-supervised framework for characterizing colorectal cancer using endomicroscopic images

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages