fundus_circle_cropping

Code for extracting a circular mask from fundus images and tightly cropping the images around the mask.

https://github.com/berenslab/fundus_circle_cropping

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 2 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.0%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

Code for extracting a circular mask from fundus images and tightly cropping the images around the mask.

Basic Info
  • Host: GitHub
  • Owner: berenslab
  • License: other
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 10.9 MB
Statistics
  • Stars: 3
  • Watchers: 3
  • Forks: 1
  • Open Issues: 0
  • Releases: 3
Created over 2 years ago · Last pushed about 2 years ago
Metadata Files
Readme License Citation

README.md

DOI

Overview

Fundus images are processed by (1) finding a circular mask with least-squares expectation-maximization fitting of a circle to the image edges, and (2) cropping the image tightly around the found circle.

With this preprocessing method, all images are equally centered, some background pixels are removed, and a boolean mask of the extracted circle is stored.

| original | cropped | mask | |------------|------------|------------| |||| |||| |||| ||||

Installation

Setup a python environment with a python version between >=3.6 and <3.12. Then, install all the other dependencies directly from source python git clone https://github.com/berenslab/fundus_circle_cropping cd fundus_circle_cropping pip install -e .

Basic example

Download some example data of healthy fundus images from https://www5.cs.fau.de/research/data/fundus-images/ with a bash script bash bash download_data/download.sh This will create a data/images folder to store the images and an image identity file data/ids.lst with a list of filenames.

To crop the downloaded fundus images, run the sample script crop.py, which expects a configuration basic_example.yaml and runs over the downloaded data. python python crop.py -c ./configs/basic_example.yaml

The preprocessed images are stored in data/images_cropped and the corresponding circular masks in data/masks.

Parallel processing with ray

Since the image preprocessing of images can be run independently, we also support code parallel processing with ray. We have one example configuration file ray_eyample.yaml on how to run that. python python crop.py -c ./configs/ray_example.yaml

Note

If you run the code on other retinal fundus datasets, adjust the root_folder in the config file and provide a text file with image names. The preprocessing parameters were optimized with the kaggle-dr-dataset and may need to be adjusted for other datasets.

Cite

If you use this software, please cite it as below. @software{mueller_fundus_circle_cropping_2023, author = {M\"uller, Sarah and Heidrich, Holger and Koch, Lisa M. and Berens, Philipp}, doi = {10.5281/zenodo.10137935}, title = {fundus circle cropping}, url = {https://github.com/berenslab/fundus_circle_cropping}, version = {0.2.0}, year = {2023} }

Owner

  • Name: Berens Lab @ University of Tübingen
  • Login: berenslab
  • Kind: organization
  • Email: philipp.berens@uni-tuebingen.de
  • Location: Tübingen, Germany

Department of Data Science at the Hertie Institute for AI in Brain Health, University of Tübingen

Citation (CITATION.cff)

cff-version: 0.1.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Mueller"
  given-names: "Sarah"
- family-names: "Heidrich"
  given-names: "Holger"
- family-names: "Koch"
  given-names: "Lisa M."
- family-names: "Berens"
  given-names: "Philipp"
title: "fundus circle cropping"
version: 0.2.0
doi: 10.5281/zenodo.10137935
date-released: 2023-11-115
url: "https://github.com/berenslab/fundus_circle_cropping"

GitHub Events

Total
  • Watch event: 1
Last Year
  • Watch event: 1

Dependencies

requirements.txt pypi
  • Pillow ==10.0.1
  • numpy ==1.26.1
  • opencv-python ==4.8.1.78
  • pyyaml ==6.0.1
  • scikit-image ==0.22.0
setup.py pypi