(self, img: torch.Tensor, lazy: bool | None = None)
| 547 | self.roi_scale = roi_scale |
| 548 | |
| 549 | def __call__(self, img: torch.Tensor, lazy: bool | None = None) -> torch.Tensor: # type: ignore[override] |
| 550 | img_size = img.peek_pending_shape() if isinstance(img, MetaTensor) else img.shape[1:] |
| 551 | ndim = len(img_size) |
| 552 | roi_size = [ceil(r * s) for r, s in zip(ensure_tuple_rep(self.roi_scale, ndim), img_size)] |
| 553 | lazy_ = self.lazy if lazy is None else lazy |
| 554 | cropper = CenterSpatialCrop(roi_size=roi_size, lazy=lazy_) |
| 555 | return super().__call__(img=img, slices=cropper.compute_slices(img_size), lazy=lazy_) |
| 556 | |
| 557 | |
| 558 | class RandSpatialCrop(Randomizable, Crop): |
nothing calls this directly
no test coverage detected