Coverage for src/deepdraw/data/chasedb1/__init__.py: 93%
15 statements
« prev ^ index » next coverage.py v7.3.1, created at 2023-11-30 15:00 +0100
« prev ^ index » next coverage.py v7.3.1, created at 2023-11-30 15:00 +0100
1# SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch>
2#
3# SPDX-License-Identifier: GPL-3.0-or-later
5"""CHASE-DB1 dataset for Vessel Segmentation.
7The CHASE_DB1 is a retinal vessel reference dataset acquired from multiethnic
8school children. This database is a part of the Child Heart and Health Study in
9England (CHASE), a cardiovascular health survey in 200 primary schools in
10London, Birmingham, and Leicester. The ocular imaging was carried out in
1146 schools and demonstrated associations between retinal vessel tortuosity and
12early risk factors for cardiovascular disease in over 1000 British primary
13school children of different ethnic origin. The retinal images of both of the
14eyes of each child were recorded with a hand-held Nidek NM-200-D fundus camera.
15The images were captured at 30 degrees FOV camera. The dataset of images are
16characterized by having nonuniform back-ground illumination, poor contrast of
17blood vessels as compared with the background and wider arteriolars that have a
18bright strip running down the centre known as the central vessel reflex.
20* Reference: [CHASEDB1-2012]_
21* Original resolution (height x width): 960 x 999
22* Split reference: [CHASEDB1-2012]_
23* Protocol ``first-annotator``:
25 * Training samples: 8 (including labels from annotator "1stHO")
26 * Test samples: 20 (including labels from annotator "1stHO")
28* Protocol ``second-annotator``:
30 * Training samples: 8 (including labels from annotator "2ndHO")
31 * Test samples: 20 (including labels from annotator "2ndHO")
32"""
34import os
36import pkg_resources
38from ...data.dataset import JSONDataset
39from ...utils.rc import load_rc
40from ..loader import load_pil_1, load_pil_rgb, make_delayed
42_protocols = [
43 pkg_resources.resource_filename(__name__, "first-annotator.json"),
44 pkg_resources.resource_filename(__name__, "second-annotator.json"),
45]
47_root_path = load_rc().get("datadir.chasedb1", os.path.realpath(os.curdir))
49_pkg_path = pkg_resources.resource_filename(__name__, "masks")
52def _raw_data_loader(sample):
53 return dict(
54 data=load_pil_rgb(os.path.join(_root_path, sample["data"])),
55 label=load_pil_1(os.path.join(_root_path, sample["label"])),
56 mask=load_pil_1(os.path.join(_pkg_path, sample["mask"])),
57 )
60def _loader(context, sample):
61 # "context" is ignored in this case - database is homogeneous
62 # we returned delayed samples to avoid loading all images at once
63 return make_delayed(sample, _raw_data_loader)
66dataset = JSONDataset(
67 protocols=_protocols, fieldnames=("data", "label", "mask"), loader=_loader
68)
69"""CHASE-DB1 dataset object."""