Dictionary-based version :py:class:`monai.transforms.RandRotate` Randomly rotates the input arrays. This transform is capable of lazy execution. See the :ref:`Lazy Resampling topic ` for more information. Args: keys: Keys to pick data for transformation
| 1813 | |
| 1814 | |
| 1815 | class RandRotated(RandomizableTransform, MapTransform, InvertibleTransform, LazyTransform): |
| 1816 | """ |
| 1817 | Dictionary-based version :py:class:`monai.transforms.RandRotate` |
| 1818 | Randomly rotates the input arrays. |
| 1819 | |
| 1820 | This transform is capable of lazy execution. See the :ref:`Lazy Resampling topic<lazy_resampling>` |
| 1821 | for more information. |
| 1822 | |
| 1823 | Args: |
| 1824 | keys: Keys to pick data for transformation. |
| 1825 | range_x: Range of rotation angle in radians in the plane defined by the first and second axes. |
| 1826 | If single number, angle is uniformly sampled from (-range_x, range_x). |
| 1827 | range_y: Range of rotation angle in radians in the plane defined by the first and third axes. |
| 1828 | If single number, angle is uniformly sampled from (-range_y, range_y). only work for 3D data. |
| 1829 | range_z: Range of rotation angle in radians in the plane defined by the second and third axes. |
| 1830 | If single number, angle is uniformly sampled from (-range_z, range_z). only work for 3D data. |
| 1831 | prob: Probability of rotation. |
| 1832 | keep_size: If it is False, the output shape is adapted so that the |
| 1833 | input array is contained completely in the output. |
| 1834 | If it is True, the output shape is the same as the input. Default is True. |
| 1835 | mode: {``"bilinear"``, ``"nearest"``} |
| 1836 | Interpolation mode to calculate output values. Defaults to ``"bilinear"``. |
| 1837 | See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html |
| 1838 | It also can be a sequence of string, each element corresponds to a key in ``keys``. |
| 1839 | padding_mode: {``"zeros"``, ``"border"``, ``"reflection"``} |
| 1840 | Padding mode for outside grid values. Defaults to ``"border"``. |
| 1841 | See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html |
| 1842 | It also can be a sequence of string, each element corresponds to a key in ``keys``. |
| 1843 | align_corners: Defaults to False. |
| 1844 | See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.interpolate.html |
| 1845 | It also can be a sequence of bool, each element corresponds to a key in ``keys``. |
| 1846 | dtype: data type for resampling computation. Defaults to ``float64`` for best precision. |
| 1847 | If None, use the data type of input data. To be compatible with other modules, |
| 1848 | the output data type is always ``float32``. |
| 1849 | It also can be a sequence of dtype or None, each element corresponds to a key in ``keys``. |
| 1850 | allow_missing_keys: don't raise exception if key is missing. |
| 1851 | lazy: a flag to indicate whether this transform should execute lazily or not. |
| 1852 | Defaults to False |
| 1853 | """ |
| 1854 | |
| 1855 | backend = RandRotate.backend |
| 1856 | |
| 1857 | def __init__( |
| 1858 | self, |
| 1859 | keys: KeysCollection, |
| 1860 | range_x: tuple[float, float] | float = 0.0, |
| 1861 | range_y: tuple[float, float] | float = 0.0, |
| 1862 | range_z: tuple[float, float] | float = 0.0, |
| 1863 | prob: float = 0.1, |
| 1864 | keep_size: bool = True, |
| 1865 | mode: SequenceStr = GridSampleMode.BILINEAR, |
| 1866 | padding_mode: SequenceStr = GridSamplePadMode.BORDER, |
| 1867 | align_corners: Sequence[bool] | bool = False, |
| 1868 | dtype: Sequence[DtypeLike | torch.dtype] | DtypeLike | torch.dtype = np.float32, |
| 1869 | allow_missing_keys: bool = False, |
| 1870 | lazy: bool = False, |
| 1871 | ) -> None: |
| 1872 | MapTransform.__init__(self, keys, allow_missing_keys) |
no outgoing calls
searching dependent graphs…