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

Method __init__

monai/transforms/croppad/dictionary.py:291–326  ·  view source on GitHub ↗

Args: keys: keys of the corresponding items to be transformed. See also: :py:class:`monai.transforms.compose.MapTransform` k: the target k for each spatial dimension. if `k` is negative or 0, the original size is preserved.

(
        self,
        keys: KeysCollection,
        k: Sequence[int] | int,
        mode: SequenceStr = PytorchPadMode.CONSTANT,
        method: str = Method.SYMMETRIC,
        allow_missing_keys: bool = False,
        lazy: bool = False,
        **kwargs,
    )

Source from the content-addressed store, hash-verified

289 backend = DivisiblePad.backend
290
291 def __init__(
292 self,
293 keys: KeysCollection,
294 k: Sequence[int] | int,
295 mode: SequenceStr = PytorchPadMode.CONSTANT,
296 method: str = Method.SYMMETRIC,
297 allow_missing_keys: bool = False,
298 lazy: bool = False,
299 **kwargs,
300 ) -> None:
301 """
302 Args:
303 keys: keys of the corresponding items to be transformed.
304 See also: :py:class:`monai.transforms.compose.MapTransform`
305 k: the target k for each spatial dimension.
306 if `k` is negative or 0, the original size is preserved.
307 if `k` is an int, the same `k` be applied to all the input spatial dimensions.
308 mode: available modes for numpy array:{``"constant"``, ``"edge"``, ``"linear_ramp"``, ``"maximum"``,
309 ``"mean"``, ``"median"``, ``"minimum"``, ``"reflect"``, ``"symmetric"``, ``"wrap"``, ``"empty"``}
310 available modes for PyTorch Tensor: {``"constant"``, ``"reflect"``, ``"replicate"``, ``"circular"``}.
311 One of the listed string values or a user supplied function. Defaults to ``"constant"``.
312 See also: https://numpy.org/doc/1.18/reference/generated/numpy.pad.html
313 https://pytorch.org/docs/stable/generated/torch.nn.functional.pad.html
314 It also can be a sequence of string, each element corresponds to a key in ``keys``.
315 method: {``"symmetric"``, ``"end"``}
316 Pad image symmetrically on every side or only pad at the end sides. Defaults to ``"symmetric"``.
317 allow_missing_keys: don't raise exception if key is missing.
318 lazy: a flag to indicate whether this transform should execute lazily or not. Defaults to False.
319 kwargs: other arguments for the `np.pad` or `torch.pad` function.
320 note that `np.pad` treats channel dimension as the first dimension.
321
322 See also :py:class:`monai.transforms.SpatialPad`
323
324 """
325 padder = DivisiblePad(k=k, method=method, lazy=lazy, **kwargs)
326 Padd.__init__(self, keys, padder=padder, mode=mode, allow_missing_keys=allow_missing_keys, lazy=lazy)
327
328
329class Cropd(MapTransform, InvertibleTransform, LazyTransform):

Callers

nothing calls this directly

Calls 2

DivisiblePadClass · 0.90
__init__Method · 0.45

Tested by

no test coverage detected