Dictionary-based wrapper of :py:class:`monai.transforms.Resize`. This transform is capable of lazy execution. See the :ref:`Lazy Resampling topic ` for more information. Args: keys: keys of the corresponding items to be transformed. See also: :p
| 784 | |
| 785 | |
| 786 | class Resized(MapTransform, InvertibleTransform, LazyTransform): |
| 787 | """ |
| 788 | Dictionary-based wrapper of :py:class:`monai.transforms.Resize`. |
| 789 | |
| 790 | This transform is capable of lazy execution. See the :ref:`Lazy Resampling topic<lazy_resampling>` |
| 791 | for more information. |
| 792 | |
| 793 | Args: |
| 794 | keys: keys of the corresponding items to be transformed. |
| 795 | See also: :py:class:`monai.transforms.compose.MapTransform` |
| 796 | spatial_size: expected shape of spatial dimensions after resize operation. |
| 797 | if some components of the `spatial_size` are non-positive values, the transform will use the |
| 798 | corresponding components of img size. For example, `spatial_size=(32, -1)` will be adapted |
| 799 | to `(32, 64)` if the second spatial dimension size of img is `64`. |
| 800 | size_mode: should be "all" or "longest", if "all", will use `spatial_size` for all the spatial dims, |
| 801 | if "longest", rescale the image so that only the longest side is equal to specified `spatial_size`, |
| 802 | which must be an int number in this case, keeping the aspect ratio of the initial image, refer to: |
| 803 | https://albumentations.ai/docs/api_reference/augmentations/geometric/resize/ |
| 804 | #albumentations.augmentations.geometric.resize.LongestMaxSize. |
| 805 | mode: {``"nearest"``, ``"nearest-exact"``, ``"linear"``, ``"bilinear"``, ``"bicubic"``, ``"trilinear"``, ``"area"``} |
| 806 | The interpolation mode. Defaults to ``"area"``. |
| 807 | See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.interpolate.html |
| 808 | It also can be a sequence of string, each element corresponds to a key in ``keys``. |
| 809 | align_corners: This only has an effect when mode is |
| 810 | 'linear', 'bilinear', 'bicubic' or 'trilinear'. Default: None. |
| 811 | See also: https://pytorch.org/docs/stable/generated/torch.nn.functional.interpolate.html |
| 812 | It also can be a sequence of bool or None, each element corresponds to a key in ``keys``. |
| 813 | anti_aliasing: bool |
| 814 | Whether to apply a Gaussian filter to smooth the image prior |
| 815 | to downsampling. It is crucial to filter when downsampling |
| 816 | the image to avoid aliasing artifacts. See also ``skimage.transform.resize`` |
| 817 | anti_aliasing_sigma: {float, tuple of floats}, optional |
| 818 | Standard deviation for Gaussian filtering used when anti-aliasing. |
| 819 | By default, this value is chosen as (s - 1) / 2 where s is the |
| 820 | downsampling factor, where s > 1. For the up-size case, s < 1, no |
| 821 | anti-aliasing is performed prior to rescaling. |
| 822 | dtype: data type for resampling computation. Defaults to ``float32``. |
| 823 | If None, use the data type of input data. |
| 824 | allow_missing_keys: don't raise exception if key is missing. |
| 825 | lazy: a flag to indicate whether this transform should execute lazily or not. |
| 826 | Defaults to False |
| 827 | """ |
| 828 | |
| 829 | backend = Resize.backend |
| 830 | |
| 831 | def __init__( |
| 832 | self, |
| 833 | keys: KeysCollection, |
| 834 | spatial_size: Sequence[int] | int, |
| 835 | size_mode: str = "all", |
| 836 | mode: SequenceStr = InterpolateMode.AREA, |
| 837 | align_corners: Sequence[bool | None] | bool | None = None, |
| 838 | anti_aliasing: Sequence[bool] | bool = False, |
| 839 | anti_aliasing_sigma: Sequence[Sequence[float] | float | None] | Sequence[float] | float | None = None, |
| 840 | dtype: Sequence[DtypeLike | torch.dtype] | DtypeLike | torch.dtype = np.float32, |
| 841 | allow_missing_keys: bool = False, |
| 842 | lazy: bool = False, |
| 843 | ) -> None: |
no outgoing calls
searching dependent graphs…