Dictionary-based wrapper of :py:class:`monai.transforms.CenterSpatialCrop`. If a dimension of the expected ROI size is larger than the input image size, will not crop that dimension. So the cropped result may be smaller than the expected ROI, and the cropped results of several images ma
| 596 | |
| 597 | |
| 598 | class CenterSpatialCropd(Cropd): |
| 599 | """ |
| 600 | Dictionary-based wrapper of :py:class:`monai.transforms.CenterSpatialCrop`. |
| 601 | If a dimension of the expected ROI size is larger than the input image size, will not crop that dimension. |
| 602 | So the cropped result may be smaller than the expected ROI, and the cropped results of several images may |
| 603 | not have exactly the same shape. |
| 604 | |
| 605 | This transform is capable of lazy execution. See the :ref:`Lazy Resampling topic<lazy_resampling>` |
| 606 | for more information. |
| 607 | |
| 608 | Args: |
| 609 | keys: keys of the corresponding items to be transformed. |
| 610 | See also: monai.transforms.MapTransform |
| 611 | roi_size: the size of the crop region e.g. [224,224,128] |
| 612 | if a dimension of ROI size is larger than image size, will not crop that dimension of the image. |
| 613 | If its components have non-positive values, the corresponding size of input image will be used. |
| 614 | for example: if the spatial size of input data is [40, 40, 40] and `roi_size=[32, 64, -1]`, |
| 615 | the spatial size of output data will be [32, 40, 40]. |
| 616 | allow_missing_keys: don't raise exception if key is missing. |
| 617 | lazy: a flag to indicate whether this transform should execute lazily or not. Defaults to False. |
| 618 | """ |
| 619 | |
| 620 | def __init__( |
| 621 | self, keys: KeysCollection, roi_size: Sequence[int] | int, allow_missing_keys: bool = False, lazy: bool = False |
| 622 | ) -> None: |
| 623 | cropper = CenterSpatialCrop(roi_size, lazy=lazy) |
| 624 | super().__init__(keys, cropper=cropper, allow_missing_keys=allow_missing_keys, lazy=lazy) |
| 625 | |
| 626 | |
| 627 | class CenterScaleCropd(Cropd): |
no outgoing calls
no test coverage detected
searching dependent graphs…