• Stars
    star
    134
  • Rank 270,967 (Top 6 %)
  • Language
    Python
  • License
    BSD 3-Clause "New...
  • Created almost 8 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Project for segmentation of blood vessels, microaneurysm and hardexudates in fundus images.

Blood Vessel Segmentation and Microaneurysm Detection for Diabetic Retinopathy

In this project, we extract features namely blood vessels microaneurysms and exudates for the purpose of analysing fundus images to detect signs of retinal tissue damage.

For exudates segmentation, Please visit Retinal Exudates Detection.

Table of Contents

Getting Started

These instructions will get you a copy of the project up and running on your local machine for you to test the algorithms on your own fundus images. The MESSIDOR database has been used for demonstration here for which we are grateful.

Preprocessing


The main idea is to use ImageMagick's convert tool to trim off the blank space to the sides of the images, then pad them so that they are all 256x256. Thus the eye is always centered with edges against the edges of the image.

And also to create multiple versions of each image varying by hue and contrast and white balance.

Prerequisites

You must have ImageMagick's convert tool and GNU Parallel installed in order to run this.

$ sudo apt install imagemagick
$ sudo apt install parallel

These are available in all the major linux repositories.

Usage

Run prep_image.sh on each image to prepare the image variations and resized images.

  • NOTE: Make sure "Allow executing file as a program" is checked in the prep_image.sh Properties.

Assuming that your train and test images are in folders train/ and test/ respectively and the file prep_image.sh lies in your project's root directory, run the following command:

$ ls train/*.jpeg test/*.jpeg | parallel ./prep_image.sh

This will preprocess all the images into processed/<variation>/train/ and processed/<variation>/test/.



Bloodvessel Segmentation


Prerequisites

The following must be installed and configured:

Follow the links for source and installation instructions.

Usage

Change the pathFolder and destinationFolder variable in the file bloodvessels.py to point to the directory where your images are located.

pathFolder = "/home/sherlock/DR/MODEL_1_SVM/Base11/"
destinationFolder = "/home/sherlock/DR/MODEL_1_SVM/Base11Bloodvessels/"

Open a terminal and navigate to where the bloodvessels.py file is located and run the following command:

$ python bloodvessels.py

OR

$ python3 bloodvessels.py

For each image in your input folder, this will save one image <imageName>_Bloodvessel.png (segmented Bloodvessels).

Sample Output

For some image in Base11:

Following resultant image is generated in the Destination folder:

  • Bloodvessels.png



Microaneurysm Detection


Prerequisites

The following must be installed and configured:

Follow the links for source and installation instructions.

Usage

Change the pathFolder variable in the file microaneurysm.py to point to the directory where your images are located.

pathFolder = "/home/utkarsh/SimpleCV/input"
  • NOTE: Make sure you manually create a file ma.csv in the same directory as that of microaneurysm.py. Open a terminal and navigate to where the microaneurysm.py file is located and run the following command:
$ python microaneurysm.py

OR

$ python3 microaneurysm.py

depending upon the version of python for which SimpleCV is configured.

For each image in your input folder, this will save two images <imageName>_MA.tif (detected aneurysms in white over black image) and <imageName>_MAoverlay.tif (detected aneurysms in white overlaid upon the original image). Also, the file ma.csv will now contain the white pixel count from the <imageName>_MA.tif for each image in the input folder.

Sample Output

For a single image in the input folder /home/utkarsh/SimpleCV/input/input.tif:

Following two images are generated in the same folder as microaneurysm.py:

  • input_MA.tif and input_MAoverlay.tif

  • The ma.csv file looks like:
microaneurysmcount countvalue
input_microaneurysm.jpg 2920

Documents

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the BSD-3-Clause License - see the LICENSE.md file for details