Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1#!/usr/bin/env python 

2# coding=utf-8 

3 

4"""DRHAGIS dataset for Vessel Segmentation 

5 

6The DR HAGIS database has been created to aid the development of vessel extraction algorithms 

7suitable for retinal screening programmes. Researchers are encouraged to test their 

8segmentation algorithms using this database. 

9 

10It should be noted that image 24 and 32 are identical, as this fundus image was obtained 

11from a patient exhibiting both diabetic retinopathy and age-related macular degeneration. 

12 

13 

14The images resolutions (height x width) are: 

15 - 4752x3168 or 

16 - 3456x2304 or 

17 - 3126x2136 or 

18 - 2896x1944 or 

19 - 2816x1880 or 

20 

21* Protocol ``default``: 

22 

23 * Training samples: 19 (including labels and masks) 

24 * Test samples: 20 (including labels and masks) 

25 

26 

27""" 

28 

29import os 

30 

31import pkg_resources 

32 

33import bob.extension 

34 

35from ..dataset import JSONDataset 

36from ..loader import load_pil_1, load_pil_rgb, make_delayed 

37 

38_protocols = [ 

39 pkg_resources.resource_filename(__name__, "default.json"), 

40] 

41 

42_root_path = bob.extension.rc.get( 

43 "bob.ip.binseg.drhagis.datadir", os.path.realpath(os.curdir) 

44) 

45 

46 

47def _raw_data_loader(sample): 

48 return dict( 

49 data=load_pil_rgb(os.path.join(_root_path, sample["data"])), 

50 label=load_pil_1(os.path.join(_root_path, sample["label"])), 

51 mask=load_pil_1(os.path.join(_root_path, sample["mask"])), 

52 ) 

53 

54 

55def _loader(context, sample): 

56 # "context" is ignored in this case - database is homogeneous 

57 # we returned delayed samples to avoid loading all images at once 

58 return make_delayed(sample, _raw_data_loader) 

59 

60 

61dataset = JSONDataset( 

62 protocols=_protocols, 

63 fieldnames=("data", "label", "mask"), 

64 loader=_loader, 

65) 

66"""DRHAGIS dataset object"""