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

Method __call__

monai/transforms/spatial/array.py:732–742  ·  view source on GitHub ↗

Args: img: channel first array, must have shape: (num_channels, H[, W, ..., ]) lazy: a flag to indicate whether this transform should execute lazily or not during this call. Setting this to False or True overrides the ``lazy`` flag set

(self, img: torch.Tensor, lazy: bool | None = None)

Source from the content-addressed store, hash-verified

730 self.spatial_axis = spatial_axis
731
732 def __call__(self, img: torch.Tensor, lazy: bool | None = None) -> torch.Tensor:
733 """
734 Args:
735 img: channel first array, must have shape: (num_channels, H[, W, ..., ])
736 lazy: a flag to indicate whether this transform should execute lazily or not
737 during this call. Setting this to False or True overrides the ``lazy`` flag set
738 during initialization for this call. Defaults to None.
739 """
740 img = convert_to_tensor(img, track_meta=get_track_meta())
741 lazy_ = self.lazy if lazy is None else lazy
742 return flip(img, self.spatial_axis, lazy=lazy_, transform_info=self.get_transform_info()) # type: ignore
743
744 def inverse(self, data: torch.Tensor) -> torch.Tensor:
745 self.pop_transform(data)

Callers 3

inverseMethod · 0.45
__call__Method · 0.45
__call__Method · 0.45

Calls 4

convert_to_tensorFunction · 0.90
get_track_metaFunction · 0.90
flipFunction · 0.90
get_transform_infoMethod · 0.80

Tested by

no test coverage detected