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

Method __call__

monai/transforms/intensity/array.py:1306–1320  ·  view source on GitHub ↗

Apply the transform to `img`.

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

Source from the content-addressed store, hash-verified

1304 self.gamma_value = self.R.uniform(low=self.gamma[0], high=self.gamma[1])
1305
1306 def __call__(self, img: NdarrayOrTensor, randomize: bool = True) -> NdarrayOrTensor:
1307 """
1308 Apply the transform to `img`.
1309 """
1310 img = convert_to_tensor(img, track_meta=get_track_meta())
1311 if randomize:
1312 self.randomize()
1313
1314 if not self._do_transform:
1315 return img
1316
1317 if self.gamma_value is None:
1318 raise RuntimeError("gamma_value is not set, please call `randomize` function first.")
1319
1320 return self.adjust_contrast(img, self.gamma_value)
1321
1322
1323class ScaleIntensityRangePercentiles(Transform):

Callers

nothing calls this directly

Calls 3

randomizeMethod · 0.95
convert_to_tensorFunction · 0.90
get_track_metaFunction · 0.90

Tested by

no test coverage detected