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

Method __call__

monai/transforms/intensity/array.py:428–442  ·  view source on GitHub ↗

Apply the transform to `img`.

(self, img: NdarrayOrTensor, randomize: bool = True)

Source from the content-addressed store, hash-verified

426 self.factor = self.R.uniform(low=self.factors[0], high=self.factors[1])
427
428 def __call__(self, img: NdarrayOrTensor, randomize: bool = True) -> NdarrayOrTensor:
429 """
430 Apply the transform to `img`.
431 """
432 img = convert_to_tensor(img, track_meta=get_track_meta(), dtype=self.dtype)
433 if randomize:
434 self.randomize()
435
436 if not self._do_transform:
437 return img
438
439 shifter = StdShiftIntensity(
440 factor=self.factor, nonzero=self.nonzero, channel_wise=self.channel_wise, dtype=self.dtype
441 )
442 return shifter(img=img)
443
444
445class ScaleIntensity(Transform):

Callers

nothing calls this directly

Calls 4

randomizeMethod · 0.95
convert_to_tensorFunction · 0.90
get_track_metaFunction · 0.90
StdShiftIntensityClass · 0.85

Tested by

no test coverage detected