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):
490
490
weights = np .ones_like (jaccards , dtype = float )
491
491
if self .inputs .weighting != "none" :
492
492
volumes = np .sum ((refdata + tstdata ) > 0 , axis = 1 ).reshape ((- 1 , ncomp ))
493
- weights = 1.0 / np . array ( volumes )
493
+ weights = 1.0 / volumes
494
494
if self .inputs .weighting == "squared_vol" :
495
495
weights = weights ** 2
496
496
497
497
weights = weights / np .sum (weights )
498
498
dices = 2.0 * jaccards / (jaccards + 1.0 )
499
499
500
500
# 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 ]
508
505
return runtime
509
506
510
507
You can’t perform that action at this time.
0 commit comments