Skip to content

eyepy.data

load(name)

Load sample data.

Parameters:

Name Type Description Default
name str

Name of the sample data to load. Currently only "drusen_patient" is supported.

required

Returns:

Type Description
EyeVolume

Sample data with many drusen as EyeVolume object.

Source code in src/eyepy/data/__init__.py
def load(name: str) -> ep.EyeVolume:
    """Load sample data.

    Args:
        name: Name of the sample data to load. Currently only "drusen_patient" is supported.

    Returns:
        Sample data with many drusen as EyeVolume object.
    """
    data_dir = EYEPY_DATA_DIR / name
    if not data_dir.is_dir():
        download_path = EYEPY_DATA_DIR / (name + '.zip')
        urllib.request.urlretrieve(SAMPLE_DATA[name][0], download_path)
        with zipfile.ZipFile(download_path, 'r') as zip_ref:
            zip_ref.extractall(EYEPY_DATA_DIR)
        download_path.unlink()

    return SAMPLE_DATA[name][1](EYEPY_DATA_DIR / name / 'metaclean.xml')