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

Method __call__

monai/transforms/spatial/dictionary.py:748–773  ·  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

746 super().randomize(None)
747
748 def __call__(
749 self, data: Mapping[Hashable, torch.Tensor], lazy: bool | None = None
750 ) -> Mapping[Hashable, torch.Tensor]:
751 """
752 Args:
753 data: a dictionary containing the tensor-like data to be processed. The ``keys`` specified
754 in this dictionary must be tensor like arrays that are channel first and have at most
755 three spatial dimensions
756 lazy: a flag to indicate whether this transform should execute lazily or not
757 during this call. Setting this to False or True overrides the ``lazy`` flag set
758 during initialization for this call. Defaults to None.
759
760 Returns:
761 a dictionary containing the transformed data, as well as any other data present in the dictionary
762 """
763 self.randomize()
764 d = dict(data)
765
766 # FIXME: here we didn't use array version `RandRotate90` transform as others, because we need
767 # to be compatible with the random status of some previous integration tests
768 lazy_ = self.lazy if lazy is None else lazy
769 rotator = Rotate90(self._rand_k, self.spatial_axes, lazy=lazy_)
770 for key in self.key_iterator(d):
771 d[key] = rotator(d[key]) if self._do_transform else convert_to_tensor(d[key], track_meta=get_track_meta())
772 self.push_transform(d[key], replace=True, lazy=lazy_)
773 return d
774
775 def inverse(self, data: Mapping[Hashable, torch.Tensor]) -> dict[Hashable, torch.Tensor]:
776 d = dict(data)

Callers

nothing calls this directly

Calls 6

randomizeMethod · 0.95
Rotate90Class · 0.90
convert_to_tensorFunction · 0.90
get_track_metaFunction · 0.90
key_iteratorMethod · 0.80
push_transformMethod · 0.80

Tested by

no test coverage detected