Manual Segmentation of lung CT images in python from open-cv, matplotlib, numpy, and pydicom. This was inspired by SciXChange Medical Physics labs which were done in MatLab.
- Clone the repository
- Create a virtual environment:
virtualenv venv
. - Activate the virtual environment:
venv\Scripts\activate
- Download the requirements:
pip install -r requirements.txt
- Download and extract
slices.zip
from the database L. Sorensen - Ensure the path is correct when loading the image!
The main segmenter is in the ctimage.py
file, which holds a class that has the functions that creates the masks and other necessary images.
An interactable program in matplotlib that will let you determine a threshold. It will display the original ct image, the binary mask, and the processed lung mask which will highlight emphysemic areas (dark areas).
A simple program that will display the thresholded images and percentage of emphysemic areas.
Similar to manualThreshold.py, except it loades in DICOM format images. It is current a WIP as normalization is needed.
For the databases:
-
L. Sørensen, S. B. Shaker, and M. de Bruijne, Quantitative Analysis of Pulmonary Emphysema using Local Binary Patterns, IEEE Transactions on Medical Imaging 29(2): 559-569, 2010. [PDF to publication]