-
Notifications
You must be signed in to change notification settings - Fork 1.5k
inverse lazily applied cropforeground with k_divisible>1 #6404
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
import torch
import monai.transforms as t
from monai.transforms.lazy.functional import apply_transforms
img = torch.tensor([[[0, 0, 0, 0, 0], [0, 1, 2, 1, 0], [0, 2, 3, 2, 0], [0, 1, 2, 1, 0], [0, 0, 0, 0, 0]]])
kwargs = {"select_fn": lambda x: x > 0, "channel_indices": None, "margin": 0, "k_divisible": 10}
xform = t.CropForeground(**kwargs)
xform.lazy_evaluation = True
pending_result = xform(img)
result = apply_transforms(pending_result, mode="nearest")[0]
print(xform.inverse(result))error:
monai/transforms/inverse.py", line 258, in check_transforms_match
raise RuntimeError(
RuntimeError: Error CropForeground getting the most recently applied invertible transform Pad 140360605105696 != 140360605208640.
cc @KumoLiu
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working