Skip to content

Commit

Permalink
Update all tests to be compatible with multi-class 'assert_metrics' f…
Browse files Browse the repository at this point in the history
…unction
  • Loading branch information
valosekj committed Mar 6, 2024
1 parent 038d10b commit e921b19
Showing 1 changed file with 35 additions and 35 deletions.
70 changes: 35 additions & 35 deletions tests/test_compute_metrics_reloaded.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ def test_empty_ref_and_pred(self):
Empty reference and empty prediction
"""

expected_metrics = {'EmptyPred': True,
'EmptyRef': True,
'dsc': 1,
'fbeta': 1,
'nsd': np.nan,
'rel_vol_error': 0,
'vol_diff': np.nan}
expected_metrics = {1.0: {'EmptyPred': True,
'EmptyRef': True,
'dsc': 1,
'fbeta': 1,
'nsd': np.nan,
'rel_vol_error': 0,
'vol_diff': np.nan}}

# Create empty reference
self.create_dummy_nii(self.ref_file, np.zeros((10, 10, 10)))
Expand All @@ -75,13 +75,13 @@ def test_empty_ref(self):
Empty reference and non-empty prediction
"""

expected_metrics = {'EmptyPred': False,
'EmptyRef': True,
'dsc': 0.0,
'fbeta': 0,
'nsd': 0.0,
'rel_vol_error': 100,
'vol_diff': np.inf}
expected_metrics = {1.0: {'EmptyPred': False,
'EmptyRef': True,
'dsc': 0.0,
'fbeta': 0,
'nsd': 0.0,
'rel_vol_error': 100,
'vol_diff': np.inf}}

# Create empty reference
self.create_dummy_nii(self.ref_file, np.zeros((10, 10, 10)))
Expand All @@ -99,13 +99,13 @@ def test_empty_pred(self):
Non-empty reference and empty prediction
"""

expected_metrics = {'EmptyPred': True,
'EmptyRef': False,
'dsc': 0.0,
'fbeta': 0,
'nsd': 0.0,
'rel_vol_error': -100.0,
'vol_diff': 1.0}
expected_metrics = {1.0: {'EmptyPred': True,
'EmptyRef': False,
'dsc': 0.0,
'fbeta': 0,
'nsd': 0.0,
'rel_vol_error': -100.0,
'vol_diff': 1.0}}

# Create non-empty reference
ref = np.zeros((10, 10, 10))
Expand All @@ -123,13 +123,13 @@ def test_non_empty_ref_and_pred(self):
Non-empty reference and non-empty prediction with partial overlap
"""

expected_metrics = {'EmptyPred': False,
'EmptyRef': False,
'dsc': 0.26666666666666666,
'fbeta': 0.26666667461395266,
'nsd': 0.5373134328358209,
'rel_vol_error': 300.0,
'vol_diff': 3.0}
expected_metrics = {1.0: {'EmptyPred': False,
'EmptyRef': False,
'dsc': 0.26666666666666666,
'fbeta': 0.26666667461395266,
'nsd': 0.5373134328358209,
'rel_vol_error': 300.0,
'vol_diff': 3.0}}

# Create non-empty reference
ref = np.zeros((10, 10, 10))
Expand Down Expand Up @@ -185,13 +185,13 @@ def test_non_empty_ref_and_pred_with_full_overlap(self):
Non-empty reference and non-empty prediction with full overlap
"""

expected_metrics = {'EmptyPred': False,
'EmptyRef': False,
'dsc': 1.0,
'fbeta': 1.0,
'nsd': 1.0,
'rel_vol_error': 0.0,
'vol_diff': 0.0}
expected_metrics = {1.0: {'EmptyPred': False,
'EmptyRef': False,
'dsc': 1.0,
'fbeta': 1.0,
'nsd': 1.0,
'rel_vol_error': 0.0,
'vol_diff': 0.0}}

# Create non-empty reference
ref = np.zeros((10, 10, 10))
Expand Down

0 comments on commit e921b19

Please sign in to comment.