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

Method __call__

monai/transforms/intensity/array.py:971–979  ·  view source on GitHub ↗

Apply the transform to `img`.

(self, img: NdarrayOrTensor)

Source from the content-addressed store, hash-verified

969 self.cval = cval
970
971 def __call__(self, img: NdarrayOrTensor) -> NdarrayOrTensor:
972 """
973 Apply the transform to `img`.
974 """
975 img = convert_to_tensor(img, track_meta=get_track_meta())
976 mask = img > self.threshold if self.above else img < self.threshold
977 res = where(mask, img, self.cval)
978 res, *_ = convert_data_type(res, dtype=img.dtype)
979 return res
980
981
982class ScaleIntensityRange(Transform):

Callers

nothing calls this directly

Calls 4

convert_to_tensorFunction · 0.90
get_track_metaFunction · 0.90
whereFunction · 0.90
convert_data_typeFunction · 0.90

Tested by

no test coverage detected