MCPcopy Create free account
hub / github.com/HiLab-git/WORD / cal_metric

Function cal_metric

word_metrics_computing.py:18–24  ·  view source on GitHub ↗
(gt, pred, voxel_spacing)

Source from the content-addressed store, hash-verified

16from medpy import metric
17
18def cal_metric(gt, pred, voxel_spacing):
19 if pred.sum() > 0 and gt.sum() > 0:
20 dice = metric.binary.dc(pred, gt)
21 hd95 = metric.binary.hd95(pred, gt, voxelspacing=voxel_spacing)
22 return np.array([dice, hd95])
23 else:
24 return np.array([0.0, 50])
25
26def each_cases_metric(gt, pred, voxel_spacing):
27 classes_num = gt.max() + 1

Callers 1

each_cases_metricFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected