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

Class Zoomd

monai/transforms/spatial/dictionary.py:1941–2035  ·  view source on GitHub ↗

Dictionary-based wrapper of :py:class:`monai.transforms.Zoom`. This transform is capable of lazy execution. See the :ref:`Lazy Resampling topic ` for more information. Args: keys: Keys to pick data for transformation. zoom: The zoom factor along the

Source from the content-addressed store, hash-verified

1939
1940
1941class Zoomd(MapTransform, InvertibleTransform, LazyTransform):
1942 """
1943 Dictionary-based wrapper of :py:class:`monai.transforms.Zoom`.
1944
1945 This transform is capable of lazy execution. See the :ref:`Lazy Resampling topic<lazy_resampling>`
1946 for more information.
1947
1948 Args:
1949 keys: Keys to pick data for transformation.
1950 zoom: The zoom factor along the spatial axes.
1951 If a float, zoom is the same for each spatial axis.
1952 If a sequence, zoom should contain one value for each spatial axis.
1953 mode: {``"nearest"``, ``"nearest-exact"``, ``"linear"``, ``"bilinear"``, ``"bicubic"``, ``"trilinear"``, ``"area"``}
1954 The interpolation mode. Defaults to ``"area"``.
1955 See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.interpolate.html
1956 It also can be a sequence of string, each element corresponds to a key in ``keys``.
1957 padding_mode: available modes for numpy array:{``"constant"``, ``"edge"``, ``"linear_ramp"``, ``"maximum"``,
1958 ``"mean"``, ``"median"``, ``"minimum"``, ``"reflect"``, ``"symmetric"``, ``"wrap"``, ``"empty"``}
1959 available modes for PyTorch Tensor: {``"constant"``, ``"reflect"``, ``"replicate"``, ``"circular"``}.
1960 One of the listed string values or a user supplied function. Defaults to ``"edge"``.
1961 The mode to pad data after zooming.
1962 See also: https://numpy.org/doc/1.18/reference/generated/numpy.pad.html
1963 https://pytorch.org/docs/stable/generated/torch.nn.functional.pad.html
1964 align_corners: This only has an effect when mode is
1965 'linear', 'bilinear', 'bicubic' or 'trilinear'. Default: None.
1966 See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.interpolate.html
1967 It also can be a sequence of bool or None, each element corresponds to a key in ``keys``.
1968 dtype: data type for resampling computation. Defaults to ``float32``.
1969 If None, use the data type of input data.
1970 keep_size: Should keep original size (pad if needed), default is True.
1971 allow_missing_keys: don&#x27;t raise exception if key is missing.
1972 lazy: a flag to indicate whether this transform should execute lazily or not.
1973 Defaults to False
1974 kwargs: other arguments for the `np.pad` or `torch.pad` function.
1975 note that `np.pad` treats channel dimension as the first dimension.
1976
1977 """
1978
1979 backend = Zoom.backend
1980
1981 def __init__(
1982 self,
1983 keys: KeysCollection,
1984 zoom: Sequence[float] | float,
1985 mode: SequenceStr = InterpolateMode.AREA,
1986 padding_mode: SequenceStr = NumpyPadMode.EDGE,
1987 align_corners: Sequence[bool | None] | bool | None = None,
1988 dtype: Sequence[DtypeLike | torch.dtype] | DtypeLike | torch.dtype = np.float32,
1989 keep_size: bool = True,
1990 allow_missing_keys: bool = False,
1991 lazy: bool = False,
1992 **kwargs,
1993 ) -> None:
1994 MapTransform.__init__(self, keys, allow_missing_keys)
1995 LazyTransform.__init__(self, lazy=lazy)
1996
1997 self.mode = ensure_tuple_rep(mode, len(self.keys))
1998 self.padding_mode = ensure_tuple_rep(padding_mode, len(self.keys))

Callers 4

test_correct_resultsMethod · 0.90
test_keep_sizeMethod · 0.90
test_invalid_inputsMethod · 0.90
test_inverse.pyFile · 0.90

Calls

no outgoing calls

Tested by 3

test_correct_resultsMethod · 0.72
test_keep_sizeMethod · 0.72
test_invalid_inputsMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…