Dictionary-based wrapper of :py:class:`monai.transforms.ScaleIntensityRange`. Args: keys: keys of the corresponding items to be transformed. See also: monai.transforms.MapTransform a_min: intensity original range min. a_max: intensity original range max.
| 865 | |
| 866 | |
| 867 | class ScaleIntensityRanged(MapTransform): |
| 868 | """ |
| 869 | Dictionary-based wrapper of :py:class:`monai.transforms.ScaleIntensityRange`. |
| 870 | |
| 871 | Args: |
| 872 | keys: keys of the corresponding items to be transformed. |
| 873 | See also: monai.transforms.MapTransform |
| 874 | a_min: intensity original range min. |
| 875 | a_max: intensity original range max. |
| 876 | b_min: intensity target range min. |
| 877 | b_max: intensity target range max. |
| 878 | clip: whether to perform clip after scaling. |
| 879 | dtype: output data type, if None, same as input image. defaults to float32. |
| 880 | allow_missing_keys: don't raise exception if key is missing. |
| 881 | """ |
| 882 | |
| 883 | backend = ScaleIntensityRange.backend |
| 884 | |
| 885 | def __init__( |
| 886 | self, |
| 887 | keys: KeysCollection, |
| 888 | a_min: float, |
| 889 | a_max: float, |
| 890 | b_min: float | None = None, |
| 891 | b_max: float | None = None, |
| 892 | clip: bool = False, |
| 893 | dtype: DtypeLike = np.float32, |
| 894 | allow_missing_keys: bool = False, |
| 895 | ) -> None: |
| 896 | super().__init__(keys, allow_missing_keys) |
| 897 | self.scaler = ScaleIntensityRange(a_min, a_max, b_min, b_max, clip, dtype) |
| 898 | |
| 899 | def __call__(self, data: Mapping[Hashable, NdarrayOrTensor]) -> dict[Hashable, NdarrayOrTensor]: |
| 900 | d = dict(data) |
| 901 | for key in self.key_iterator(d): |
| 902 | d[key] = self.scaler(d[key]) |
| 903 | return d |
| 904 | |
| 905 | |
| 906 | class ClipIntensityPercentilesd(MapTransform): |
no outgoing calls
searching dependent graphs…