| 941 | return cropped |
| 942 | |
| 943 | def inverse(self, img: MetaTensor) -> MetaTensor: |
| 944 | transform = self.get_most_recent_transform(img) |
| 945 | # we moved the padding info in the forward, so put it back for the inverse |
| 946 | pad_info = transform[TraceKeys.EXTRA_INFO].pop("pad_info") |
| 947 | img.applied_operations.append(pad_info) |
| 948 | # first inverse the padder |
| 949 | inv = self.padder.inverse(img) |
| 950 | # and then inverse the cropper (self) |
| 951 | return super().inverse(inv) |
| 952 | |
| 953 | |
| 954 | class RandWeightedCrop(Randomizable, TraceableTransform, LazyTransform, MultiSampleTrait): |