Skip to content

followup of #1878 #1913

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions monai/apps/pathology/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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),
Expand All @@ -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
Expand All @@ -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.
Expand Down
9 changes: 5 additions & 4 deletions tests/test_lesion_froc.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def prepare_test_data():
]


TEST_CASE_5 = [
TEST_CASE_6 = [
{
"data": [
{
Expand All @@ -207,7 +207,7 @@ def prepare_test_data():
2.0 / 3.0,
]

TEST_CASE_6 = [
TEST_CASE_7 = [
{
"data": [
{
Expand All @@ -229,7 +229,7 @@ def prepare_test_data():
0.4,
]

TEST_CASE_7 = [
TEST_CASE_8 = [
{
"data": [
{
Expand Down Expand Up @@ -257,7 +257,7 @@ def prepare_test_data():
1.0 / 3.0,
]

TEST_CASE_8 = [
TEST_CASE_9 = [
{
"data": [
{
Expand Down Expand Up @@ -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):
Expand Down