Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Signed-off-by: KumoLiu <[email protected]>
  • Loading branch information
KumoLiu committed Jul 14, 2023
1 parent a7bdb9d commit 334359e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions monai/transforms/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1398,10 +1398,10 @@ def convert_applied_interp_mode(trans_info, mode: str = "nearest", align_corners
trans_info = dict(trans_info)
if "mode" in trans_info:
current_mode = trans_info["mode"]
if current_mode[0] in _interp_modes:
trans_info["mode"] = [mode for _ in range(len(mode))]
elif current_mode in _interp_modes:
if isinstance(current_mode, int) or current_mode in _interp_modes:
trans_info["mode"] = mode
elif isinstance(current_mode[0], int) or current_mode[0] in _interp_modes:
trans_info["mode"] = [mode for _ in range(len(mode))]
if "align_corners" in trans_info:
_align_corners = TraceKeys.NONE if align_corners is None else align_corners
current_value = trans_info["align_corners"]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_invert.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def test_invert(self):
LoadImage(image_only=True),
EnsureChannelFirst(),
Orientation("RPS"),
Spacing(pixdim=(1.2, 1.01, 0.9), mode="bilinear", dtype=np.float32),
Spacing(pixdim=(1.2, 1.01, 0.9), mode=1, dtype=np.float32),
RandFlip(prob=0.5, spatial_axis=[1, 2]),
RandAxisFlip(prob=0.5),
RandRotate90(prob=0, spatial_axes=(1, 2)),
Expand Down
2 changes: 1 addition & 1 deletion tests/test_invertd.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def test_invert(self):
RandRotate90d(KEYS, prob=0, spatial_axes=(1, 2)),
RandZoomd(KEYS, prob=0.5, min_zoom=0.5, max_zoom=1.1, keep_size=True),
RandRotated(KEYS, prob=0.5, range_x=np.pi, mode="bilinear", align_corners=True, dtype=np.float64),
RandAffined(KEYS, prob=0.5, rotate_range=np.pi, mode="nearest"),
RandAffined(KEYS, prob=0.5, rotate_range=np.pi, mode=["nearest", 0]),
ResizeWithPadOrCropd(KEYS, 100),
CastToTyped(KEYS, dtype=[torch.uint8, np.uint8]),
CopyItemsd("label", times=2, names=["label_inverted", "label_inverted1"]),
Expand Down

0 comments on commit 334359e

Please sign in to comment.