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

Method __call__

monai/transforms/intensity/array.py:1634–1646  ·  view source on GitHub ↗
(self, img: NdarrayTensor)

Source from the content-addressed store, hash-verified

1632 self.approx = approx
1633
1634 def __call__(self, img: NdarrayTensor) -> NdarrayTensor:
1635 img = convert_to_tensor(img, track_meta=get_track_meta())
1636 img_t, *_ = convert_data_type(img, torch.Tensor, dtype=torch.float)
1637 sigma: Sequence[torch.Tensor] | torch.Tensor
1638 if isinstance(self.sigma, Sequence):
1639 sigma = [torch.as_tensor(s, device=img_t.device) for s in self.sigma]
1640 else:
1641 sigma = torch.as_tensor(self.sigma, device=img_t.device)
1642 gaussian_filter = GaussianFilter(img_t.ndim - 1, sigma, approx=self.approx)
1643 out_t: torch.Tensor = gaussian_filter(img_t.unsqueeze(0)).squeeze(0)
1644 out, *_ = convert_to_dst_type(out_t, dst=img, dtype=out_t.dtype)
1645
1646 return out
1647
1648
1649class RandGaussianSmooth(RandomizableTransform):

Callers

nothing calls this directly

Calls 6

convert_to_tensorFunction · 0.90
get_track_metaFunction · 0.90
convert_data_typeFunction · 0.90
GaussianFilterClass · 0.90
convert_to_dst_typeFunction · 0.90
as_tensorMethod · 0.80

Tested by

no test coverage detected