Skip to main content

👁️ Retinalysis fundus preprocessing

Fundus / CFI bounds extraction, cropping and contrast enhancement

📦 Installation

pip install retinalysis-fundusprep

Basic usage: running from the command line

We include a command line utility for running fundus preprocessing. The prep command handles both directory and CSV input formats:

fundusprep prep <input_path> [OPTIONS]

Where <input_path> can be either:

  • 📁 A directory containing fundus images to process
  • 📄 A CSV/TXT file with a 'path' column containing image file paths

If a CSV file is provided and it contains an 'id' column, those values will be used as image identifiers instead of automatically generating them from filenames.

⚙️ Options

  • --rgb_path PATH: Directory where processed RGB images will be saved
  • --ce_path PATH: Directory where contrast-enhanced images will be saved
  • --bounds_path PATH: Path to save a CSV file containing image bounds information
  • --n_jobs INTEGER: Number of parallel processing workers (default: 4)

📝 Notes

  • All output paths are optional - files will only be written when the corresponding path is provided
  • Missing image files will be reported but won't stop the processing of other images
  • The bounds CSV contains information about how images were cropped for standardization
  • All output images are saved in PNG format with the same filename as the input image.

💡 Examples

Processing Folder with RGB Images

To process a folder of fundus images and save only the RGB versions along with the bounds information:

fundusprep prep ./original_images \
  --rgb_path ./processed_rgb \
  --bounds_path ./metadata/bounds.csv

Processing with Contrast Enhancement

To process images with both RGB and contrast enhancement:

fundusprep prep ./original_images \
  --rgb_path ./processed_rgb \
  --ce_path ./contrast_enhanced \
  --bounds_path ./metadata/bounds.csv

Processing Images Listed in a CSV (No Custom IDs)

Example CSV:

path
/data/images/patient1.jpg
/data/images/patient2.jpg
/data/images/patient3.png

To process images listed in a CSV file:

fundusprep prep ./image_list.csv \
  --rgb_path ./processed_rgb \
  --ce_path ./contrast_enhanced \
  --bounds_path ./metadata/bounds.csv

The outputs will use the same filenames as the input images. For example, the RGB output for /data/images/patient2.jpg will be ./preprocessed_rgb/patient2.png. Note that all outputs will be stored in a single folder, and therefore filenames should be unique. If filenames are not unique, use custom image IDs.

Using Custom Image IDs

The CSV file must include:

  • A path column with absolute or relative paths to the image files
  • an id column to specify custom identifiers for each image

Example CSV:

path,id
/data/images/patient1.jpg,P1_left
/data/images/patient2.jpg,P2_right

Processing is done in the same way:

fundusprep prep ./patient_images.csv \
  --rgb_path ./processed_rgb \
  --ce_path ./contrast_enhanced \
  --bounds_path ./metadata/bounds.csv

The RGB output for /data/images/patient2.jpg will be ./preprocessed_rgb/P2_right.png.

Metadata

Release files for retinalysis-fundusprep 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for retinalysis-fundusprep 1.1.0
File Size Uploaded
retinalysis_fundusprep-1.1.0.tar.gz 26.4 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for retinalysis-fundusprep 1.1.0
File Interpreter ABI Platform
retinalysis_fundusprep-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 26.4 MB

Release files / retinalysis_fundusprep-1.1.0.tar.gz

Download URL retinalysis_fundusprep-1.1.0.tar.gz
Size 26.4 MB
Tags Source
SHA-256 checksum
How to use checksums
84111f0de5782f0305248f664a48d2e0336df823422708283758f675e8fe3611
BLAKE2b-256 checksum
How to use checksums
015357369f2e42b687921236df88fca29d23fa6301e2f2c6a482f0e7171deca0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / retinalysis_fundusprep-1.1.0-py3-none-any.whl

Download URL retinalysis_fundusprep-1.1.0-py3-none-any.whl
Size 42.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3a17fea2352a0ae0e2ded064dd7596d31d57b365fbedc991a119a9d79d2c613c
BLAKE2b-256 checksum
How to use checksums
af34701ccd43fe96fc12ad4d1c32ccfa1a23cd954295935c7a1e26ef42809d29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

1.3.0

2 release files

1.2.0

1 release file

This release

1.1.0 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page