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

Class ScaleIntensityd

monai/transforms/intensity/dictionary.py:550–590  ·  view source on GitHub ↗

Dictionary-based wrapper of :py:class:`monai.transforms.ScaleIntensity`. Scale the intensity of input image to the given value range (minv, maxv). If `minv` and `maxv` not provided, use `factor` to scale image by ``v = v * (1 + factor)``.

Source from the content-addressed store, hash-verified

548
549
550class ScaleIntensityd(MapTransform):
551 """
552 Dictionary-based wrapper of :py:class:`monai.transforms.ScaleIntensity`.
553 Scale the intensity of input image to the given value range (minv, maxv).
554 If `minv` and `maxv` not provided, use `factor` to scale image by ``v = v * (1 + factor)``.
555 """
556
557 backend = ScaleIntensity.backend
558
559 def __init__(
560 self,
561 keys: KeysCollection,
562 minv: float | None = 0.0,
563 maxv: float | None = 1.0,
564 factor: float | None = None,
565 channel_wise: bool = False,
566 dtype: DtypeLike = np.float32,
567 allow_missing_keys: bool = False,
568 ) -> None:
569 """
570 Args:
571 keys: keys of the corresponding items to be transformed.
572 See also: :py:class:`monai.transforms.compose.MapTransform`
573 minv: minimum value of output data.
574 maxv: maximum value of output data.
575 factor: factor scale by ``v = v * (1 + factor)``. In order to use
576 this parameter, please set both `minv` and `maxv` into None.
577 channel_wise: if True, scale on each channel separately. Please ensure
578 that the first dimension represents the channel of the image if True.
579 dtype: output data type, if None, same as input image. defaults to float32.
580 allow_missing_keys: don't raise exception if key is missing.
581
582 """
583 super().__init__(keys, allow_missing_keys)
584 self.scaler = ScaleIntensity(minv, maxv, factor, channel_wise, dtype)
585
586 def __call__(self, data: Mapping[Hashable, NdarrayOrTensor]) -> dict[Hashable, NdarrayOrTensor]:
587 d = dict(data)
588 for key in self.key_iterator(d):
589 d[key] = self.scaler(d[key])
590 return d
591
592
593class RandScaleIntensityd(RandomizableTransform, MapTransform):

Callers 15

get_dataFunction · 0.90
initializeMethod · 0.90
initializeMethod · 0.90
run_training_testFunction · 0.90
test_train_timingMethod · 0.90
run_training_testFunction · 0.90
run_inference_testFunction · 0.90
run_training_testFunction · 0.90
run_inference_testFunction · 0.90
run_training_testFunction · 0.90
test_valuesMethod · 0.90
test_valuesMethod · 0.90

Calls

no outgoing calls

Tested by 15

run_training_testFunction · 0.72
test_train_timingMethod · 0.72
run_training_testFunction · 0.72
run_inference_testFunction · 0.72
run_training_testFunction · 0.72
run_inference_testFunction · 0.72
run_training_testFunction · 0.72
test_valuesMethod · 0.72
test_valuesMethod · 0.72
test_valuesMethod · 0.72
test_valuesMethod · 0.72
test_range_scaleMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…