Skip to content

Commit 31040c8

Browse files
authored
auto updates (#7077)
1 parent 8b7effd commit 31040c8

4 files changed

Lines changed: 9 additions & 8 deletions

File tree

monai/metrics/hausdorff_distance.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,10 @@ def _compute_percentile_hausdorff_distance(
211211
return torch.tensor(torch.nan, dtype=torch.float, device=surface_distance.device)
212212

213213
if not percentile:
214-
return surface_distance.max() # type: ignore[no-any-return]
214+
return surface_distance.max()
215215

216216
if 0 <= percentile <= 100:
217-
return torch.quantile(surface_distance, percentile / 100) # type: ignore[no-any-return]
217+
return torch.quantile(surface_distance, percentile / 100)
218218
raise ValueError(f"percentile should be a value between 0 and 100, get {percentile}.")
219219

220220

monai/metrics/surface_dice.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ def compute_surface_dice(
269269
else:
270270
areas_pred, areas_gt = areas # type: ignore
271271
areas_gt, areas_pred = areas_gt[edges_gt], areas_pred[edges_pred]
272-
boundary_complete = areas_gt.sum() + areas_pred.sum() # type: ignore
272+
boundary_complete = areas_gt.sum() + areas_pred.sum()
273273
gt_true = areas_gt[distances_gt_pred <= class_thresholds[c]].sum() if len(areas_gt) > 0 else 0.0
274274
pred_true = areas_pred[distances_pred_gt <= class_thresholds[c]].sum() if len(areas_pred) > 0 else 0.0
275275
boundary_correct = gt_true + pred_true

monai/metrics/utils.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def get_mask_edges(
204204
if crop:
205205
or_vol = seg_pred | seg_gt
206206
if not or_vol.any():
207-
pred, gt = lib.zeros(seg_pred.shape, dtype=bool), lib.zeros(seg_gt.shape, dtype=bool) # type: ignore
207+
pred, gt = lib.zeros(seg_pred.shape, dtype=bool), lib.zeros(seg_gt.shape, dtype=bool)
208208
return (pred, gt) if spacing is None else (pred, gt, pred, gt) # type: ignore
209209
channel_first = [seg_pred[None], seg_gt[None], or_vol[None]]
210210
if spacing is None and not use_cucim: # cpu only erosion
@@ -275,11 +275,11 @@ def get_surface_distance(
275275
"""
276276
lib: ModuleType = torch if isinstance(seg_pred, torch.Tensor) else np
277277
if not seg_gt.any():
278-
dis = lib.inf * lib.ones_like(seg_gt, dtype=lib.float32) # type: ignore
278+
dis = lib.inf * lib.ones_like(seg_gt, dtype=lib.float32)
279279
else:
280-
if not lib.any(seg_pred): # type: ignore
281-
dis = lib.inf * lib.ones_like(seg_gt, dtype=lib.float32) # type: ignore
282-
dis = dis[seg_gt] # type: ignore
280+
if not lib.any(seg_pred):
281+
dis = lib.inf * lib.ones_like(seg_gt, dtype=lib.float32)
282+
dis = dis[seg_gt]
283283
return convert_to_dst_type(dis, seg_pred, dtype=dis.dtype)[0]
284284
if distance_metric == "euclidean":
285285
dis = monai_distance_transform_edt((~seg_gt)[None, ...], sampling=spacing)[0] # type: ignore

tests/min_tests.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def run_testsuit():
5252
"test_csv_dataset",
5353
"test_csv_iterable_dataset",
5454
"test_cumulative_average_dist",
55+
"test_sampler_dist",
5556
"test_dataset",
5657
"test_dataset_summary",
5758
"test_deepedit_transforms",

0 commit comments

Comments
 (0)