MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / pop_transform

Method pop_transform

monai/transforms/inverse.py:386–401  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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):

Callers 15

push_transformMethod · 0.95
inverseMethod · 0.80
inverseMethod · 0.80
inverseMethod · 0.80
inverseMethod · 0.80
__call__Method · 0.80
inverseMethod · 0.80
inverseMethod · 0.80
__call__Method · 0.80
inverseMethod · 0.80
inverseMethod · 0.80
__call__Method · 0.80

Calls 1

Tested by 3

inverseMethod · 0.64
inverseMethod · 0.64
popMethod · 0.64