/chest_xray_view_detect

Detecting current view in chest x-rays

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Detecting view in chest x-ray images

The main goal of this repository is to provide an “easy to use” tool that can be used to detect the patients’ view position in chest x-ray images. So far, it is able to differentiate between frontal, lateral and non chest images.

How to install the software:

The original implementation of this program has been programmed in Python using the Pytorch deep learning toolkit and the fast.ai library. However, installing deep learning libraries in certain settings can be cumbersome or not convenient. We have simplified this process by encapsulating all the heavy lifting inside a Docker container.

Install Docker:

Please follow the guide to install Docker for your operating system:

If you are on Linux a want to use the GPU capabilities of your local machine, please be sure that you install the nvidia-docker (version 2.0) packages. For this particular problem, we discourage it, as in most of our experiments, the software runs in less than 10 seconds without using the GPU.

Install Python:

A Python installation. Then, install all the required packages using pip as follows:

pip install pyfiglet docker

or using the requirements file:

pip install -r requirements.txt

How to use it:

To use this tool, just run python detect_chest_view.py --help from the same source folder to see all the available options. The first time you run the software, it will download automatically the automated docker container from the Docker Hub.

Mandatory parameters:

  • input_image (--input_image): input scan to process. The input scan can be an image file (jpeg, bmp, etc…) or a DICOM dcm file.

Optional parameters:

  • model (--model): Model to use. (not implemented yet).
  • gpu use (--gpu): use GPU for faster inference (default=No).
  • update (--update): update the Docker image.

Example:

Just an example of how to use the software. Let’s use some of the cases of the examples folder. In the case of jpeg file:

python detect_chest_view.py --input_image examples/dcm/pneumonia_example.dcm

When finished, the software will generate a file called pneumonia_example.csv file with the predicted view:

License:

This software is released under the version 3 of the GNU General Public License. Please read the license terms before using the software. A copy of this license is present in the root directory.

Contact

Contact: Sergi Valverde, Postodoctoral researcher, University of Girona, Spain.