Table of Contents
This is a Python implementation of the B-COSFIRE algorithm, which was originally implemented in MATLAB by Nicola Strisciuglio et. al. Please find the B-COSFIRE paper here (2015).
The B-COSFIRE filter aims to segment elongated patterns in images such as blood vessels in retinal images. It is based on an existing filter, so-called Combination Of Shifted FIlter Responses (COSFIRE). While the COSFIRE filters are used to detect bifurcations in the retinal images, the B-COSFIRE filters (as B stands for bar) are used to detect bar-like structures (e.g. vessels) in the images. Please check the COSFIRE paper (2013) to understand the basics of the algorithm.
The core of the B-COSFIRE algorithm relies on the Difference-of-Gaussians (DoG) filters which are used for detecting lines and edges. Since the vessels in the retinal images vary in orientation and thickness, it is a challenging task to define convenient filters for such a complexity. The B-COSFIRE algorithm comes up with a smart idea for this challenge:
- The user provides a vessel-like prototype pattern, e.g., a bar.
- The pattern is filtered with a DoG filter followed by a blur operation in order to reduce the noise.
- The positions of the maximum points on the bar are marked by using a circle strategy.
- A DoG filter is defined for each position.
- The input image (e.g. retinal image) is filtered with the shifted DoG filters, and this results in the DoG responses.
- The weighted geometric mean of the DoG responses give the output of the B-COSFIRE filter.
You need python3 for this project.
To get a local copy, you can follow the following steps.
You can install the repository and required Python packages by following the steps below.
- Clone the repo
git clone https://github.com/Brains-for-hire/diabetic-retinopathy/tree/master/cosfire- Install required packages
pip3 install -r requirements.txtTo run the BCOSFIRE algorithm on the sample image ./data/sample_0.tif, you can run the following command in the terminal.
python3 BCOSFIRE.py ./data/sample_0.tifSee the open issues for a list of known issues.
Any contributions are greatly appreciated.
Contributions might include anything which make the code being more efficient and yielding better results.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the BSD-3-Clause License. See LICENSE for more information.
Project Link: https://github.com/Brains-for-hire/diabetic-retinopathy