diff --git a/monai/apps/pathology/metrics.py b/monai/apps/pathology/metrics.py index 63b9d073a7..ae01d8a1db 100644 --- a/monai/apps/pathology/metrics.py +++ b/monai/apps/pathology/metrics.py @@ -9,8 +9,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import json -from typing import Dict, List, Tuple, Union +from typing import Dict, List, Tuple import numpy as np @@ -51,7 +50,7 @@ class LesionFROC: def __init__( self, - data: Union[List[Dict], str], + data: List[Dict], grow_distance: int = 75, itc_diameter: int = 200, eval_thresholds: Tuple = (0.25, 0.5, 1, 2, 4, 8), @@ -61,10 +60,7 @@ def __init__( image_reader_name: str = "cuCIM", ) -> None: - if isinstance(data, str): - self.data = self._load_data(data) - else: - self.data = data + self.data = data self.grow_distance = grow_distance self.itc_diameter = itc_diameter self.eval_thresholds = eval_thresholds @@ -75,11 +71,6 @@ def __init__( box_size=nms_box_size, ) - def _load_data(self, file_path: str) -> List[Dict]: - with open(file_path, "r") as f: - data: List[Dict] = json.load(f) - return data - def prepare_inference_result(self, sample: Dict): """ Prepare the probability map for detection evaluation. diff --git a/tests/test_lesion_froc.py b/tests/test_lesion_froc.py index 6702997c64..1f2926631f 100644 --- a/tests/test_lesion_froc.py +++ b/tests/test_lesion_froc.py @@ -185,7 +185,7 @@ def prepare_test_data(): ] -TEST_CASE_5 = [ +TEST_CASE_6 = [ { "data": [ { @@ -207,7 +207,7 @@ def prepare_test_data(): 2.0 / 3.0, ] -TEST_CASE_6 = [ +TEST_CASE_7 = [ { "data": [ { @@ -229,7 +229,7 @@ def prepare_test_data(): 0.4, ] -TEST_CASE_7 = [ +TEST_CASE_8 = [ { "data": [ { @@ -257,7 +257,7 @@ def prepare_test_data(): 1.0 / 3.0, ] -TEST_CASE_8 = [ +TEST_CASE_9 = [ { "data": [ { @@ -305,6 +305,7 @@ def setUp(self): TEST_CASE_6, TEST_CASE_7, TEST_CASE_8, + TEST_CASE_9, ] ) def test_read_patches_cucim(self, input_parameters, expected):