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

Method __call__

monai/transforms/croppad/dictionary.py:920–932  ·  view source on GitHub ↗
(self, data: Mapping[Hashable, torch.Tensor], lazy: bool | None = None)

Source from the content-addressed store, hash-verified

918 return True
919
920 def __call__(self, data: Mapping[Hashable, torch.Tensor], lazy: bool | None = None) -> dict[Hashable, torch.Tensor]:
921 d = dict(data)
922 self.cropper: CropForeground
923 box_start, box_end = self.cropper.compute_bounding_box(img=d[self.source_key])
924 if self.start_coord_key is not None:
925 d[self.start_coord_key] = box_start # type: ignore
926 if self.end_coord_key is not None:
927 d[self.end_coord_key] = box_end # type: ignore
928
929 lazy_ = self.lazy if lazy is None else lazy
930 for key, m in self.key_iterator(d, self.mode):
931 d[key] = self.cropper.crop_pad(img=d[key], box_start=box_start, box_end=box_end, mode=m, lazy=lazy_)
932 return d
933
934
935class RandWeightedCropd(Randomizable, MapTransform, LazyTransform, MultiSampleTrait):

Callers

nothing calls this directly

Calls 3

compute_bounding_boxMethod · 0.80
key_iteratorMethod · 0.80
crop_padMethod · 0.80

Tested by

no test coverage detected