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

Method __call__

monai/transforms/croppad/array.py:518–529  ·  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, lazy: bool | None = None)

Source from the content-addressed store, hash-verified

516 return super().compute_slices(roi_center=roi_center, roi_size=roi_size)
517
518 def __call__(self, img: torch.Tensor, lazy: bool | None = None) -> torch.Tensor: # type: ignore[override]
519 """
520 Apply the transform to `img`, assuming `img` is channel-first and
521 slicing doesn't apply to the channel dim.
522
523 """
524 lazy_ = self.lazy if lazy is None else lazy
525 return super().__call__(
526 img=img,
527 slices=self.compute_slices(img.peek_pending_shape() if isinstance(img, MetaTensor) else img.shape[1:]),
528 lazy=lazy_,
529 )
530
531
532class CenterScaleCrop(Crop):

Callers

nothing calls this directly

Calls 3

compute_slicesMethod · 0.95
peek_pending_shapeMethod · 0.80
__call__Method · 0.45

Tested by

no test coverage detected