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

Class Rotated

monai/transforms/spatial/dictionary.py:1724–1812  ·  view source on GitHub ↗

Dictionary-based wrapper of :py:class:`monai.transforms.Rotate`. This transform is capable of lazy execution. See the :ref:`Lazy Resampling topic ` for more information. Args: keys: Keys to pick data for transformation. angle: Rotation angle(s) in r

Source from the content-addressed store, hash-verified

1722
1723
1724class Rotated(MapTransform, InvertibleTransform, LazyTransform):
1725 """
1726 Dictionary-based wrapper of :py:class:`monai.transforms.Rotate`.
1727
1728 This transform is capable of lazy execution. See the :ref:`Lazy Resampling topic<lazy_resampling>`
1729 for more information.
1730
1731 Args:
1732 keys: Keys to pick data for transformation.
1733 angle: Rotation angle(s) in radians.
1734 keep_size: If it is False, the output shape is adapted so that the
1735 input array is contained completely in the output.
1736 If it is True, the output shape is the same as the input. Default is True.
1737 mode: {``"bilinear"``, ``"nearest"``}
1738 Interpolation mode to calculate output values. Defaults to ``"bilinear"``.
1739 See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html
1740 It also can be a sequence of string, each element corresponds to a key in ``keys``.
1741 padding_mode: {``"zeros"``, ``"border"``, ``"reflection"``}
1742 Padding mode for outside grid values. Defaults to ``"border"``.
1743 See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html
1744 It also can be a sequence of string, each element corresponds to a key in ``keys``.
1745 align_corners: Defaults to False.
1746 See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html
1747 It also can be a sequence of bool, each element corresponds to a key in ``keys``.
1748 dtype: data type for resampling computation. Defaults to ``float32``.
1749 If None, use the data type of input data. To be compatible with other modules,
1750 the output data type is always ``float32``.
1751 It also can be a sequence of dtype or None, each element corresponds to a key in ``keys``.
1752 allow_missing_keys: don&#x27;t raise exception if key is missing.
1753 lazy: a flag to indicate whether this transform should execute lazily or not.
1754 Defaults to False
1755 """
1756
1757 backend = Rotate.backend
1758
1759 def __init__(
1760 self,
1761 keys: KeysCollection,
1762 angle: Sequence[float] | float,
1763 keep_size: bool = True,
1764 mode: SequenceStr = GridSampleMode.BILINEAR,
1765 padding_mode: SequenceStr = GridSamplePadMode.BORDER,
1766 align_corners: Sequence[bool] | bool = False,
1767 dtype: Sequence[DtypeLike | torch.dtype] | DtypeLike | torch.dtype = np.float32,
1768 allow_missing_keys: bool = False,
1769 lazy: bool = False,
1770 ) -> None:
1771 MapTransform.__init__(self, keys, allow_missing_keys)
1772 LazyTransform.__init__(self, lazy=lazy)
1773 self.rotator = Rotate(angle=angle, keep_size=keep_size, lazy=lazy)
1774
1775 self.mode = ensure_tuple_rep(mode, len(self.keys))
1776 self.padding_mode = ensure_tuple_rep(padding_mode, len(self.keys))
1777 self.align_corners = ensure_tuple_rep(align_corners, len(self.keys))
1778 self.dtype = ensure_tuple_rep(dtype, len(self.keys))
1779
1780 @LazyTransform.lazy.setter # type: ignore
1781 def lazy(self, val: bool):

Callers 5

test_correct_resultsMethod · 0.90
test_correct_resultsMethod · 0.90
test_correct_resultsMethod · 0.90
test_inverse.pyFile · 0.90

Calls

no outgoing calls

Tested by 3

test_correct_resultsMethod · 0.72
test_correct_resultsMethod · 0.72
test_correct_resultsMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…