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

Method __call__

monai/transforms/spatial/dictionary.py:1608–1631  ·  view source on GitHub ↗

Args: data: a dictionary containing the tensor-like data to be processed. The ``keys`` specified in this dictionary must be tensor like arrays that are channel first and have at most three spatial dimensions lazy: a flag to indicate wh

(self, data: Mapping[Hashable, torch.Tensor], lazy: bool | None = None)

Source from the content-addressed store, hash-verified

1606 return self
1607
1608 def __call__(self, data: Mapping[Hashable, torch.Tensor], lazy: bool | None = None) -> dict[Hashable, torch.Tensor]:
1609 """
1610 Args:
1611 data: a dictionary containing the tensor-like data to be processed. The ``keys`` specified
1612 in this dictionary must be tensor like arrays that are channel first and have at most
1613 three spatial dimensions
1614 lazy: a flag to indicate whether this transform should execute lazily or not
1615 during this call. Setting this to False or True overrides the ``lazy`` flag set
1616 during initialization for this call. Defaults to None.
1617
1618 Returns:
1619 a dictionary containing the transformed data, as well as any other data present in the dictionary
1620 """
1621 d = dict(data)
1622 self.randomize(None)
1623
1624 lazy_ = self.lazy if lazy is None else lazy
1625 for key in self.key_iterator(d):
1626 if self._do_transform:
1627 d[key] = self.flipper(d[key], lazy=lazy_)
1628 else:
1629 d[key] = convert_to_tensor(d[key], track_meta=get_track_meta())
1630 self.push_transform(d[key], replace=True, lazy=lazy_)
1631 return d
1632
1633 def inverse(self, data: Mapping[Hashable, torch.Tensor]) -> dict[Hashable, torch.Tensor]:
1634 d = dict(data)

Callers

nothing calls this directly

Calls 5

convert_to_tensorFunction · 0.90
get_track_metaFunction · 0.90
key_iteratorMethod · 0.80
push_transformMethod · 0.80
randomizeMethod · 0.45

Tested by

no test coverage detected