Skip to content
Closed
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
6 changes: 3 additions & 3 deletions monai/apps/pathology/transforms/post/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,13 +361,13 @@ def _generate_contour_coord(self, current: np.ndarray, previous: np.ndarray) ->

p_delta = (current[0] - previous[0], current[1] - previous[1])

if p_delta == (0.0, 1.0) or p_delta == (0.5, 0.5) or p_delta == (1.0, 0.0):
if p_delta in ((0.0, 1.0), (0.5, 0.5), (1.0, 0.0)):
row = int(current[0] + 0.5)
col = int(current[1])
elif p_delta == (0.0, -1.0) or p_delta == (0.5, -0.5):
elif p_delta in ((0.0, -1.0), (0.5, -0.5)):
row = int(current[0])
col = int(current[1])
elif p_delta == (-1, 0.0) or p_delta == (-0.5, -0.5):
elif p_delta in ((-1, 0.0), (-0.5, -0.5)):
row = int(current[0])
col = int(current[1] + 0.5)
elif p_delta == (-0.5, 0.5):
Expand Down
2 changes: 1 addition & 1 deletion monai/networks/blocks/patchembedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def __init__(

super().__init__()

if not (spatial_dims == 2 or spatial_dims == 3):
if not spatial_dims in (2, 3):
raise ValueError("spatial dimension should be 2 or 3.")

patch_size = ensure_tuple_rep(patch_size, spatial_dims)
Expand Down
2 changes: 1 addition & 1 deletion monai/networks/nets/swin_unetr.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def __init__(
patch_size = ensure_tuple_rep(2, spatial_dims)
window_size = ensure_tuple_rep(7, spatial_dims)

if not (spatial_dims == 2 or spatial_dims == 3):
if not spatial_dims in (2, 3):
raise ValueError("spatial dimension should be 2 or 3.")

for m, p in zip(img_size, patch_size):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_tile_on_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def make_image(

tiles = np.stack(tiles_list, axis=0)

if (filter_mode == "min" or filter_mode == "max") and len(tiles) > tile_count**2:
if filter_mode in ("min", "max") and len(tiles) > tile_count**2:
tiles = tiles[np.argsort(tiles.sum(axis=(1, 2, 3)))]

return imlarge, tiles
Expand Down
2 changes: 1 addition & 1 deletion tests/test_tile_on_grid_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def make_image(

tiles = np.stack(tiles_list, axis=0)

if (filter_mode == "min" or filter_mode == "max") and len(tiles) > tile_count**2:
if filter_mode in ("min", "max") and len(tiles) > tile_count**2:
tiles = tiles[np.argsort(tiles.sum(axis=(1, 2, 3)))]

return imlarge, tiles
Expand Down