MAPLES-DR Configuration

class DatasetConfig

Dataclass storing the configuration of the dataset.

property cache_path: Path | None

Return the path to the cache directory.

Return type:

The path to the cache directory or None if the cache is disabled.

image_format: ImageFormat = 'PIL'

Python format of the generated images. See ImageFormat for the available options.

By default: ImageFormat.PIL is used.

preprocessing: Preprocessing = 'none'

Preprocessing algorithm applied on the fundus images. See Preprocessing for the available options.

By default: Preprocessing.NONE (no preprocessing) is applied.

resize: int | bool = True

Size of the generated images.

  • If int: the images are resized to a square of the given size;

  • if True: the original MAPLES-DR resolution of 1500x1500 px is kept;

  • if False: keep the original MESSIDOR resolution if MESSIDOR path is configured, otherwise fallback to MAPLES-DR original resolution.

By default: True (use MAPLES-DR 1500x1500 px resolution).


class ImageFormat

String Enum of possible image formats for fundus images and biomarker masks.

PIL = 'PIL'

Images are formatted as PIL.Image.Image.

RGB = 'rgb'

Images are formatted as numpy array. Biomarkers masks have a shape of (height, width) and fundus image have a shape of (height, width, 3) with a RGB channel order.

BGR = 'bgr'

Images are formatted as numpy array. Biomarkers masks have a shape of (height, width) and fundus image have a shape of (height, width, 3) with a BGR channel order.

__new__(value)
class Preprocessing

String Enum of possible preprocessing algorithms applied on the fundus images.

NONE = 'none'

No preprocessing.

CLAHE = 'clahe'

Preprocessing based on Contrast Limited Adaptive Histogram Equalization (CLAHE).

See maples_dr.preprocessing.clahe_preprocessing().

MEDIAN = 'median'

Preprocessing based on median filtering.

See maples_dr.preprocessing.median_preprocessing().

__new__(value)

class InvalidConfigError

Exception raised when the configuration is invalid.