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

Method __call__

monai/transforms/croppad/array.py:682–690  ·  view source on GitHub ↗

Apply the transform to `img`, assuming `img` is channel-first and slicing doesn't apply to the channel dim.

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

Source from the content-addressed store, hash-verified

680 super().randomize(img_size)
681
682 def __call__(self, img: torch.Tensor, randomize: bool = True, lazy: bool | None = None) -> torch.Tensor: # type: ignore
683 """
684 Apply the transform to `img`, assuming `img` is channel-first and
685 slicing doesn't apply to the channel dim.
686
687 """
688 self.get_max_roi_size(img.peek_pending_shape() if isinstance(img, MetaTensor) else img.shape[1:])
689 lazy_ = self.lazy if lazy is None else lazy
690 return super().__call__(img=img, randomize=randomize, lazy=lazy_)
691
692
693class RandSpatialCropSamples(Randomizable, TraceableTransform, LazyTransform, MultiSampleTrait):

Callers

nothing calls this directly

Calls 3

get_max_roi_sizeMethod · 0.95
peek_pending_shapeMethod · 0.80
__call__Method · 0.45

Tested by

no test coverage detected