File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed
Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -490,21 +490,18 @@ def _run_interface(self, runtime):
490490 weights = np .ones_like (jaccards , dtype = float )
491491 if self .inputs .weighting != "none" :
492492 volumes = np .sum ((refdata + tstdata ) > 0 , axis = 1 ).reshape ((- 1 , ncomp ))
493- weights = 1.0 / np . array ( volumes )
493+ weights = 1.0 / volumes
494494 if self .inputs .weighting == "squared_vol" :
495495 weights = weights ** 2
496496
497497 weights = weights / np .sum (weights )
498498 dices = 2.0 * jaccards / (jaccards + 1.0 )
499499
500500 # Fill-in the results object
501- self ._results ['jaccard' ] = float (np .sum (weights * jaccards ))
502- self ._results ['dice' ] = float (np .sum (weights * dices ))
503- self ._results ['class_fji' ] = [
504- float (v ) for v in jaccards .astype (float ).tolist ()]
505- self ._results ['class_fdi' ] = [
506- float (v ) for v in dices .astype (float ).tolist ()]
507-
501+ self ._results ['jaccard' ] = float (weights .dot (jaccards ))
502+ self ._results ['dice' ] = float (weights .dot (dices ))
503+ self ._results ['class_fji' ] = [float (v ) for v in jaccards ]
504+ self ._results ['class_fdi' ] = [float (v ) for v in dices ]
508505 return runtime
509506
510507
You can’t perform that action at this time.
0 commit comments