Coverage for /scratch/builds/bob/bob.med.tb/miniconda/conda-bld/bob.med.tb_1637571489937/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/lib/python3.8/site-packages/bob/med/tb/data/padchest/__init__.py: 92%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

13 statements  

1#!/usr/bin/env python 

2# coding=utf-8 

3 

4"""Padchest dataset for computer-aided diagnosis 

5 

6A large chest x-ray image dataset with multi-label annotated reports. 

7This dataset includes more than 160,000 images from 67,000 patients that were  

8interpreted and reported by radiologists at Hospital San Juan (Spain) from 2009 

9to 2017, covering six different position views and additional information on 

10image acquisition and patient demography. 

11 

12We keep only "PA" images here. 

13 

14* Reference: [PADCHEST-2019]_ 

15* Original resolution: variable, original size 

16* Labels: [PADCHEST-2019]_ 

17* Split reference: no split 

18* Protocol ``default``: 

19 

20 * Training samples: 96'269 

21 * Validation samples: 0 

22 * Test samples: 0 

23 

24* Protocol `ìdiap``: 

25 * Images path adapted to Idiap infrastructure 

26 

27* Labels: 

28 

29['COPD signs', 

30'Chilaiditi sign', 

31'NSG tube', 

32'abnormal foreign body', 

33'abscess', 

34'adenopathy', 

35'air bronchogram', 

36'air fluid level', 

37'air trapping', 

38'alveolar pattern', 

39'aortic aneurysm', 

40'aortic atheromatosis', 

41'aortic button enlargement', 

42'aortic elongation', 

43'aortic endoprosthesis', 

44'apical pleural thickening', 

45'artificial aortic heart valve', 

46'artificial heart valve', 

47'artificial mitral heart valve', 

48'asbestosis signs', 

49'ascendent aortic elongation', 

50'atelectasis', 

51'atelectasis basal', 

52'atypical pneumonia', 

53'axial hyperostosis', 

54'azygoesophageal recess shift', 

55'azygos lobe', 

56'blastic bone lesion', 

57'bone cement', 

58'bone metastasis', 

59'breast mass', 

60'bronchiectasis', 

61'bronchovascular markings', 

62'bullas', 

63'calcified adenopathy', 

64'calcified densities', 

65'calcified fibroadenoma', 

66'calcified granuloma', 

67'calcified mediastinal adenopathy', 

68'calcified pleural plaques', 

69'calcified pleural thickening', 

70'callus rib fracture', 

71'cardiomegaly', 

72'catheter', 

73'cavitation', 

74'central vascular redistribution', 

75'central venous catheter', 

76'central venous catheter via jugular vein', 

77'central venous catheter via subclavian vein', 

78'central venous catheter via umbilical vein', 

79'cervical rib', 

80'chest drain tube', 

81'chronic changes', 

82'clavicle fracture', 

83'consolidation', 

84'costochondral junction hypertrophy', 

85'costophrenic angle blunting', 

86'cyst', 

87'dai', 

88'descendent aortic elongation', 

89'dextrocardia', 

90'diaphragmatic eventration', 

91'double J stent', 

92'dual chamber device', 

93'electrical device', 

94'emphysema', 

95'empyema', 

96'end on vessel', 

97'endoprosthesis', 

98'endotracheal tube', 

99'esophagic dilatation', 

100'exclude', 

101'external foreign body', 

102'fibrotic band', 

103'fissure thickening', 

104'flattened diaphragm', 

105'fracture', 

106'gastrostomy tube', 

107'goiter', 

108'granuloma', 

109'ground glass pattern', 

110'gynecomastia', 

111'heart insufficiency', 

112'heart valve calcified', 

113'hemidiaphragm elevation', 

114'hiatal hernia', 

115'hilar congestion', 

116'hilar enlargement', 

117'humeral fracture', 

118'humeral prosthesis', 

119'hydropneumothorax', 

120'hyperinflated lung', 

121'hypoexpansion', 

122'hypoexpansion basal', 

123'increased density', 

124'infiltrates', 

125'interstitial pattern', 

126'kerley lines', 

127'kyphosis', 

128'laminar atelectasis', 

129'lepidic adenocarcinoma', 

130'lipomatosis', 

131'lobar atelectasis', 

132'loculated fissural effusion', 

133'loculated pleural effusion', 

134'lung metastasis', 

135'lung vascular paucity', 

136'lymphangitis carcinomatosa', 

137'lytic bone lesion', 

138'major fissure thickening', 

139'mammary prosthesis', 

140'mass', 

141'mastectomy', 

142'mediastinal enlargement', 

143'mediastinal mass', 

144'mediastinal shift', 

145'mediastinic lipomatosis', 

146'metal', 

147'miliary opacities', 

148'minor fissure thickening', 

149'multiple nodules', 

150'nephrostomy tube', 

151'nipple shadow', 

152'nodule', 

153'non axial articular degenerative changes', 

154'normal', 

155'obesity', 

156'osteopenia', 

157'osteoporosis', 

158'osteosynthesis material', 

159'pacemaker', 

160'pectum carinatum', 

161'pectum excavatum', 

162'pericardial effusion', 

163'pleural effusion', 

164'pleural mass', 

165'pleural plaques', 

166'pleural thickening', 

167'pneumomediastinum', 

168'pneumonia', 

169'pneumoperitoneo', 

170'pneumothorax', 

171'post radiotherapy changes', 

172'prosthesis', 

173'pseudonodule', 

174'pulmonary artery enlargement', 

175'pulmonary artery hypertension', 

176'pulmonary edema', 

177'pulmonary fibrosis', 

178'pulmonary hypertension', 

179'pulmonary mass', 

180'pulmonary venous hypertension', 

181'reservoir central venous catheter', 

182'respiratory distress', 

183'reticular interstitial pattern', 

184'reticulonodular interstitial pattern', 

185'rib fracture', 

186'right sided aortic arch', 

187'round atelectasis', 

188'sclerotic bone lesion', 

189'scoliosis', 

190'segmental atelectasis', 

191'single chamber device', 

192'soft tissue mass', 

193'sternoclavicular junction hypertrophy', 

194'sternotomy', 

195'subacromial space narrowing', 

196'subcutaneous emphysema', 

197'suboptimal study', 

198'superior mediastinal enlargement', 

199'supra aortic elongation', 

200'surgery', 

201'surgery breast', 

202'surgery heart', 

203'surgery humeral', 

204'surgery lung', 

205'surgery neck', 

206'suture material', 

207'thoracic cage deformation', 

208'total atelectasis', 

209'tracheal shift', 

210'tracheostomy tube', 

211'tuberculosis', 

212'tuberculosis sequelae', 

213'unchanged', 

214'vascular hilar enlargement', 

215'vascular redistribution', 

216'ventriculoperitoneal drain tube', 

217'vertebral anterior compression', 

218'vertebral compression', 

219'vertebral degenerative changes', 

220'vertebral fracture', 

221'volume loss'] 

222""" 

223 

224import os 

225import pkg_resources 

226 

227import bob.extension 

228 

229from ..dataset import JSONDataset 

230from ..loader import load_pil, make_delayed 

231 

232_protocols = [ 

233 pkg_resources.resource_filename(__name__, "idiap.json"), 

234 pkg_resources.resource_filename(__name__, "tb_idiap.json"), 

235 pkg_resources.resource_filename(__name__, "no_tb_idiap.json"), 

236 pkg_resources.resource_filename(__name__, "cardiomegaly_idiap.json"), 

237] 

238 

239 

240def _raw_data_loader(sample): 

241 return dict( 

242 data=load_pil( 

243 os.path.join( 

244 bob.extension.rc.get( 

245 "bob.med.tb.padchest.datadir", os.path.realpath(os.curdir) 

246 ), 

247 sample["data"], 

248 ) 

249 ), 

250 label=sample["label"], 

251 ) 

252 

253 

254def _loader(context, sample): 

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

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

257 return make_delayed(sample, _raw_data_loader) 

258 

259 

260dataset = JSONDataset( 

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

262) 

263"""Padchest dataset object"""