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

Method __init__

monai/transforms/croppad/array.py:454–478  ·  view source on GitHub ↗

Args: roi_center: voxel coordinates for center of the crop ROI. roi_size: size of the crop ROI, if a dimension of ROI size is larger than image size, will not crop that dimension of the image. roi_start: voxel coordinates for start of the

(
        self,
        roi_center: Sequence[int] | int | NdarrayOrTensor | None = None,
        roi_size: Sequence[int] | int | NdarrayOrTensor | None = None,
        roi_start: Sequence[int] | int | NdarrayOrTensor | None = None,
        roi_end: Sequence[int] | int | NdarrayOrTensor | None = None,
        roi_slices: Sequence[slice] | None = None,
        lazy: bool = False,
    )

Source from the content-addressed store, hash-verified

452 """
453
454 def __init__(
455 self,
456 roi_center: Sequence[int] | int | NdarrayOrTensor | None = None,
457 roi_size: Sequence[int] | int | NdarrayOrTensor | None = None,
458 roi_start: Sequence[int] | int | NdarrayOrTensor | None = None,
459 roi_end: Sequence[int] | int | NdarrayOrTensor | None = None,
460 roi_slices: Sequence[slice] | None = None,
461 lazy: bool = False,
462 ) -> None:
463 """
464 Args:
465 roi_center: voxel coordinates for center of the crop ROI.
466 roi_size: size of the crop ROI, if a dimension of ROI size is larger than image size,
467 will not crop that dimension of the image.
468 roi_start: voxel coordinates for start of the crop ROI.
469 roi_end: voxel coordinates for end of the crop ROI, if a coordinate is out of image,
470 use the end coordinate of image.
471 roi_slices: list of slices for each of the spatial dimensions.
472 lazy: a flag to indicate whether this transform should execute lazily or not. Defaults to False.
473
474 """
475 super().__init__(lazy)
476 self.slices = self.compute_slices(
477 roi_center=roi_center, roi_size=roi_size, roi_start=roi_start, roi_end=roi_end, roi_slices=roi_slices
478 )
479
480 def __call__(self, img: torch.Tensor, lazy: bool | None = None) -> torch.Tensor: # type: ignore[override]
481 """

Callers

nothing calls this directly

Calls 2

__init__Method · 0.45
compute_slicesMethod · 0.45

Tested by

no test coverage detected