Giter VIP home page Giter VIP logo

getsanjeev / retina-features Goto Github PK

View Code? Open in Web Editor NEW
127.0 11.0 68.0 14.8 MB

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

License: BSD 3-Clause "New" or "Revised" License

Python 78.20% Shell 21.80%
image-processing python opencv medical-image-processing diabetic-retinopathy retina blood-vessels microaneurysm segmentation fundus retina-image-analysis retinal-images exudates hardexudates-detection morphological-analysis clustering

retina-features's Introduction

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

retina-features's People

Contributors

getsanjeev avatar raghav1875 avatar utkarshmttl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

retina-features's Issues

Something problem with SimpleCV. I am sure I have Install acording to guide

Traceback (most recent call last):
File "microaneurysm.py", line 1, in
from SimpleCV import Image, Color
File "/home/chuench/.local/lib/python2.7/site-packages/SimpleCV/init.py", line 3, in
from SimpleCV.base import *
File "/home/chuench/.local/lib/python2.7/site-packages/SimpleCV/base.py", line 59, in
raise ImportError("Cannot load OpenCV library which is required by SimpleCV")

ImportError: Cannot load OpenCV library which is required by SimpleCV

CLI parameters with Click

Hello,

Instead of changing the pathFolder and destinationFolder variable in the file bloodvessels.py to point to the directory where your images are located (which can lead to inappropriate Git commits when submitting PR), you should use command line parser with default values for pathFolder and destinationFolder.

http://click.pocoo.org/5/ can help.

import click

@click.command()
@click.option('--path_folder', default='.....', help='Path folder.')
@click.option('--destination_folder', default='.....', help='Destination folder.')
def main(path_folder, destination_folder):
    print("Do it")


if __name__ == '__main__':
    main()

Choosing the binarization threshold

bloodvessels.py
ret,f6 = cv2.threshold(f5,15,255,cv2.THRESH_BINARY)

It may be necessary to apply a dynamic search for the binarization threshold, the result strongly depends on the illumination. For example Otsu's method.

Error: not enough values to unpack (expected 3, got 2)

Hello, i'm getting the error below when running bloodvessel.py, any solution behind this?

Traceback (most recent call last): File "bloodvessels.py", line 62, in <module> bloodvessel = extract_bv(fundus) File "bloodvessels.py", line 25, in extract_bv im2, contours, hierarchy = cv2.findContours(f6.copy(),cv2.RETR_LIST,cv2.CHAIN_APPROX_SIMPLE) ValueError: not enough values to unpack (expected 3, got 2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.