Return and pop the most recent transform. Args: data: dictionary of data or `MetaTensor` key: if data is a dictionary, data[key] will be modified check: if true, check that `self` is the same type as the most recently-applied transform.
(self, data, key: Hashable = None, check: bool = True)
| 384 | return all_transforms.pop(match_idx) if pop else all_transforms[match_idx] |
| 385 | |
| 386 | def pop_transform(self, data, key: Hashable = None, check: bool = True): |
| 387 | """ |
| 388 | Return and pop the most recent transform. |
| 389 | |
| 390 | Args: |
| 391 | data: dictionary of data or `MetaTensor` |
| 392 | key: if data is a dictionary, data[key] will be modified |
| 393 | check: if true, check that `self` is the same type as the most recently-applied transform. |
| 394 | |
| 395 | Returns: |
| 396 | Dictionary of most recently applied transform |
| 397 | |
| 398 | Raises: |
| 399 | - RuntimeError: data is neither `MetaTensor` nor dictionary |
| 400 | """ |
| 401 | return self.get_most_recent_transform(data, key, check, pop=True) |
| 402 | |
| 403 | @contextmanager |
| 404 | def trace_transform(self, to_trace: bool): |