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

Method __call__

monai/transforms/spatial/array.py:1467–1482  ·  view source on GitHub ↗

Args: img: channel first array, must have shape: (num_channels, H[, W, ..., ]), randomize: whether to execute `randomize()` function first, default to True. lazy: a flag to indicate whether this transform should execute lazily or not durin

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

Source from the content-addressed store, hash-verified

1465 self._lazy = val
1466
1467 def __call__(self, img: torch.Tensor, randomize: bool = True, lazy: bool | None = None) -> torch.Tensor:
1468 """
1469 Args:
1470 img: channel first array, must have shape: (num_channels, H[, W, ..., ]),
1471 randomize: whether to execute `randomize()` function first, default to True.
1472 lazy: a flag to indicate whether this transform should execute lazily or not
1473 during this call. Setting this to False or True overrides the ``lazy`` flag set
1474 during initialization for this call. Defaults to None.
1475 """
1476 if randomize:
1477 self.randomize(None)
1478 lazy_ = self.lazy if lazy is None else lazy
1479 out = self.flipper(img, lazy=lazy_) if self._do_transform else img
1480 out = convert_to_tensor(out, track_meta=get_track_meta())
1481 self.push_transform(out, replace=True, lazy=lazy_)
1482 return out
1483
1484 def inverse(self, data: torch.Tensor) -> torch.Tensor:
1485 transform = self.pop_transform(data)

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected