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

1# SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch> 

2# 

3# SPDX-License-Identifier: GPL-3.0-or-later 

4 

5"""CHASE-DB1 dataset for Vessel Segmentation. 

6 

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. 

19 

20* Reference: [CHASEDB1-2012]_ 

21* Original resolution (height x width): 960 x 999 

22* Split reference: [CHASEDB1-2012]_ 

23* Protocol ``first-annotator``: 

24 

25 * Training samples: 8 (including labels from annotator "1stHO") 

26 * Test samples: 20 (including labels from annotator "1stHO") 

27 

28* Protocol ``second-annotator``: 

29 

30 * Training samples: 8 (including labels from annotator "2ndHO") 

31 * Test samples: 20 (including labels from annotator "2ndHO") 

32""" 

33 

34import os 

35 

36import pkg_resources 

37 

38from ...data.dataset import JSONDataset 

39from ...utils.rc import load_rc 

40from ..loader import load_pil_1, load_pil_rgb, make_delayed 

41 

42_protocols = [ 

43 pkg_resources.resource_filename(__name__, "first-annotator.json"), 

44 pkg_resources.resource_filename(__name__, "second-annotator.json"), 

45] 

46 

47_root_path = load_rc().get("datadir.chasedb1", os.path.realpath(os.curdir)) 

48 

49_pkg_path = pkg_resources.resource_filename(__name__, "masks") 

50 

51 

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 ) 

58 

59 

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) 

64 

65 

66dataset = JSONDataset( 

67 protocols=_protocols, fieldnames=("data", "label", "mask"), loader=_loader 

68) 

69"""CHASE-DB1 dataset object."""