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

Method __init__

monai/transforms/croppad/dictionary.py:123–151  ·  view source on GitHub ↗

Args: keys: keys of the corresponding items to be transformed. See also: :py:class:`monai.transforms.compose.MapTransform` padder: pad transform for the input image. mode: available modes for numpy array:{``"constant"``, ``"edge"``, ``"lin

(
        self,
        keys: KeysCollection,
        padder: Pad,
        mode: SequenceStr = PytorchPadMode.CONSTANT,
        allow_missing_keys: bool = False,
        lazy: bool = False,
    )

Source from the content-addressed store, hash-verified

121 backend = Pad.backend
122
123 def __init__(
124 self,
125 keys: KeysCollection,
126 padder: Pad,
127 mode: SequenceStr = PytorchPadMode.CONSTANT,
128 allow_missing_keys: bool = False,
129 lazy: bool = False,
130 ) -> None:
131 """
132 Args:
133 keys: keys of the corresponding items to be transformed.
134 See also: :py:class:`monai.transforms.compose.MapTransform`
135 padder: pad transform for the input image.
136 mode: available modes for numpy array:{``"constant"``, ``"edge"``, ``"linear_ramp"``, ``"maximum"``,
137 ``"mean"``, ``"median"``, ``"minimum"``, ``"reflect"``, ``"symmetric"``, ``"wrap"``, ``"empty"``}
138 available modes for PyTorch Tensor: {``"constant"``, ``"reflect"``, ``"replicate"``, ``"circular"``}.
139 One of the listed string values or a user supplied function. Defaults to ``"constant"``.
140 See also: https://numpy.org/doc/1.18/reference/generated/numpy.pad.html
141 https://pytorch.org/docs/stable/generated/torch.nn.functional.pad.html
142 It also can be a sequence of string, each element corresponds to a key in ``keys``.
143 allow_missing_keys: don't raise exception if key is missing.
144 lazy: a flag to indicate whether this transform should execute lazily or not. Defaults to False.
145 """
146 MapTransform.__init__(self, keys, allow_missing_keys)
147 LazyTransform.__init__(self, lazy)
148 if lazy is True and not isinstance(padder, LazyTrait):
149 raise ValueError("'padder' must inherit LazyTrait if lazy is True " f"'padder' is of type({type(padder)})")
150 self.padder = padder
151 self.mode = ensure_tuple_rep(mode, len(self.keys))
152
153 @LazyTransform.lazy.setter # type: ignore
154 def lazy(self, value: bool) -> None:

Callers 15

__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls 1

ensure_tuple_repFunction · 0.90

Tested by

no test coverage detected