Easy, robust CFI bounds detection and contrast enhancement
Project description
Retinalysis fundus preprocessing
Fundus bounds extraction, cropping and contrast enhancement
Basic usage: running from the command line
We include command line utilities for running fundus preprocessing. Two commands:
-
preprocess-folderuse for running on a folder with input RGB images. Will not recurse into children of the input folder:fundusprep preprocess-folder <data_path> [OPTIONS]
-
preprocess-csvuse for more advanced usage to provide arbitrary filepaths and specific filenames (or IDs) for the outputs. Provide an input CSV file with columnspath(for filepath to an RGB file) andid(optional) to name/identify the outputsfundusprep preprocess-csv ./image_list.csv \ --rgb_path ./processed_rgb \ --ce_path ./contrast_enhanced \ --bounds_path ./metadata/bounds.csv
Options
Both commands share the same 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 preprocess-folder ./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 preprocess-folder ./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:
```bash
fundusprep preprocess-csv ./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
pathcolumn with absolute or relative paths to the image files - an
idcolumn 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 preprocess-csv ./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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file retinalysis_fundusprep-0.1.0.tar.gz.
File metadata
- Download URL: retinalysis_fundusprep-0.1.0.tar.gz
- Upload date:
- Size: 48.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a927244781014a2fd0dcbee600b860cc5dbc06a8c93d2d6c2c265308cc527ba
|
|
| MD5 |
fed090bf657a95133247626626900ece
|
|
| BLAKE2b-256 |
bb8c28d49e4f82ab603a5e85a1a54fcaca4aad1382f9d64aaa2c78f7139064ed
|
File details
Details for the file retinalysis_fundusprep-0.1.0-py3-none-any.whl.
File metadata
- Download URL: retinalysis_fundusprep-0.1.0-py3-none-any.whl
- Upload date:
- Size: 38.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e70e0ac868cf9cca5c9af315b90ca6af0d8ab78c9ac1e7fd0184197fa34005f6
|
|
| MD5 |
627257c0349c75500b76685597c136a1
|
|
| BLAKE2b-256 |
df045dc97199da653c38afa606c2d7651fff454e1cc4f1e2a3ee74d7768e5e51
|