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

Class RandZoomd

monai/transforms/spatial/dictionary.py:2038–2171  ·  view source on GitHub ↗

Dict-based version :py:class:`monai.transforms.RandZoom`. This transform is capable of lazy execution. See the :ref:`Lazy Resampling topic ` for more information. Args: keys: Keys to pick data for transformation. prob: Probability of zooming.

Source from the content-addressed store, hash-verified

2036
2037
2038class RandZoomd(RandomizableTransform, MapTransform, InvertibleTransform, LazyTransform):
2039 """
2040 Dict-based version :py:class:`monai.transforms.RandZoom`.
2041
2042 This transform is capable of lazy execution. See the :ref:`Lazy Resampling topic<lazy_resampling>`
2043 for more information.
2044
2045 Args:
2046 keys: Keys to pick data for transformation.
2047 prob: Probability of zooming.
2048 min_zoom: Min zoom factor. Can be float or sequence same size as image.
2049 If a float, select a random factor from `[min_zoom, max_zoom]` then apply to all spatial dims
2050 to keep the original spatial shape ratio.
2051 If a sequence, min_zoom should contain one value for each spatial axis.
2052 If 2 values provided for 3D data, use the first value for both H & W dims to keep the same zoom ratio.
2053 max_zoom: Max zoom factor. Can be float or sequence same size as image.
2054 If a float, select a random factor from `[min_zoom, max_zoom]` then apply to all spatial dims
2055 to keep the original spatial shape ratio.
2056 If a sequence, max_zoom should contain one value for each spatial axis.
2057 If 2 values provided for 3D data, use the first value for both H & W dims to keep the same zoom ratio.
2058 mode: {``"nearest"``, ``"nearest-exact"``, ``"linear"``, ``"bilinear"``, ``"bicubic"``, ``"trilinear"``, ``"area"``}
2059 The interpolation mode. Defaults to ``"area"``.
2060 See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.interpolate.html
2061 It also can be a sequence of string, each element corresponds to a key in ``keys``.
2062 padding_mode: available modes for numpy array:{``"constant"``, ``"edge"``, ``"linear_ramp"``, ``"maximum"``,
2063 ``"mean"``, ``"median"``, ``"minimum"``, ``"reflect"``, ``"symmetric"``, ``"wrap"``, ``"empty"``}
2064 available modes for PyTorch Tensor: {``"constant"``, ``"reflect"``, ``"replicate"``, ``"circular"``}.
2065 One of the listed string values or a user supplied function. Defaults to ``"edge"``.
2066 The mode to pad data after zooming.
2067 See also: https://numpy.org/doc/1.18/reference/generated/numpy.pad.html
2068 https://pytorch.org/docs/stable/generated/torch.nn.functional.pad.html
2069 align_corners: This only has an effect when mode is
2070 'linear', 'bilinear', 'bicubic' or 'trilinear'. Default: None.
2071 See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.interpolate.html
2072 It also can be a sequence of bool or None, each element corresponds to a key in ``keys``.
2073 dtype: data type for resampling computation. Defaults to ``float32``.
2074 If None, use the data type of input data.
2075 keep_size: Should keep original size (pad if needed), default is True.
2076 allow_missing_keys: don&#x27;t raise exception if key is missing.
2077 lazy: a flag to indicate whether this transform should execute lazily or not.
2078 Defaults to False
2079 kwargs: other args for `np.pad` API, note that `np.pad` treats channel dimension as the first dimension.
2080 more details: https://numpy.org/doc/1.18/reference/generated/numpy.pad.html
2081 """
2082
2083 backend = RandZoom.backend
2084
2085 def __init__(
2086 self,
2087 keys: KeysCollection,
2088 prob: float = 0.1,
2089 min_zoom: Sequence[float] | float = 0.9,
2090 max_zoom: Sequence[float] | float = 1.1,
2091 mode: SequenceStr = InterpolateMode.AREA,
2092 padding_mode: SequenceStr = NumpyPadMode.EDGE,
2093 align_corners: Sequence[bool | None] | bool | None = None,
2094 dtype: Sequence[DtypeLike | torch.dtype] | DtypeLike | torch.dtype = np.float32,
2095 keep_size: bool = True,

Callers 9

test_train_timingMethod · 0.90
test_correct_resultsMethod · 0.90
test_keep_sizeMethod · 0.90
test_invalid_inputsMethod · 0.90
test_auto_expand_3dMethod · 0.90
test_inverse.pyFile · 0.90
test_invertMethod · 0.90

Calls

no outgoing calls

Tested by 6

test_train_timingMethod · 0.72
test_correct_resultsMethod · 0.72
test_keep_sizeMethod · 0.72
test_invalid_inputsMethod · 0.72
test_auto_expand_3dMethod · 0.72
test_invertMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…