1#!/usr/bin/env python
2# coding=utf-8
3
4"""CHASE-DB1 dataset for Vessel Segmentation
5
6The CHASE_DB1 is a retinal vessel reference dataset acquired from multiethnic
7school children. This database is a part of the Child Heart and Health Study in
8England (CHASE), a cardiovascular health survey in 200 primary schools in
9London, Birmingham, and Leicester. The ocular imaging was carried out in
1046 schools and demonstrated associations between retinal vessel tortuosity and
11early risk factors for cardiovascular disease in over 1000 British primary
12school children of different ethnic origin. The retinal images of both of the
13eyes of each child were recorded with a hand-held Nidek NM-200-D fundus camera.
14The images were captured at 30 degrees FOV camera. The dataset of images are
15characterized by having nonuniform back-ground illumination, poor contrast of
16blood vessels as compared with the background and wider arteriolars that have a
17bright strip running down the centre known as the central vessel reflex.
18
19* Reference: [CHASEDB1-2012]_
20* Original resolution (height x width): 960 x 999
21* Split reference: [CHASEDB1-2012]_
22* Protocol ``first-annotator``:
23
24 * Training samples: 8 (including labels from annotator "1stHO")
25 * Test samples: 20 (including labels from annotator "1stHO")
26
27* Protocol ``second-annotator``:
28
29 * Training samples: 8 (including labels from annotator "2ndHO")
30 * Test samples: 20 (including labels from annotator "2ndHO")
31
32"""
33
34import os
35
36import pkg_resources
37
38import bob.extension
39
40from ..dataset import JSONDataset
41from ..loader import load_pil_1, load_pil_rgb, make_delayed
42
43_protocols = [
44 pkg_resources.resource_filename(__name__, "first-annotator.json"),
45 pkg_resources.resource_filename(__name__, "second-annotator.json"),
46]
47
48_root_path = bob.extension.rc.get(
49 "bob.ip.binseg.chasedb1.datadir", os.path.realpath(os.curdir)
50)
51
52_pkg_path = pkg_resources.resource_filename(__name__, "masks")
53
54
55def _raw_data_loader(sample):
56 return dict(
57 data=load_pil_rgb(os.path.join(_root_path, sample["data"])),
58 label=load_pil_1(os.path.join(_root_path, sample["label"])),
59 mask=load_pil_1(os.path.join(_pkg_path, sample["mask"])),
60 )
61
62
63def _loader(context, sample):
64 # "context" is ignored in this case - database is homogeneous
65 # we returned delayed samples to avoid loading all images at once
66 return make_delayed(sample, _raw_data_loader)
67
68
69dataset = JSONDataset(
70 protocols=_protocols, fieldnames=("data", "label", "mask"), loader=_loader
71)
72"""CHASE-DB1 dataset object"""