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

Method __call__

monai/transforms/spatial/array.py:1993–2003  ·  view source on GitHub ↗

Args: spatial_size: spatial size of the grid.

(self, spatial_size: Sequence[int])

Source from the content-addressed store, hash-verified

1991 self.rand_mag = self.R.uniform(self.magnitude[0], self.magnitude[1])
1992
1993 def __call__(self, spatial_size: Sequence[int]) -> torch.Tensor:
1994 """
1995 Args:
1996 spatial_size: spatial size of the grid.
1997 """
1998 self.spacing = fall_back_tuple(self.spacing, (1.0,) * len(spatial_size))
1999 control_grid = create_control_grid(spatial_size, self.spacing, device=self.device, backend="torch")
2000 self.randomize(control_grid.shape[1:])
2001 _offset, *_ = convert_to_dst_type(self.rand_mag * self.random_offset, control_grid)
2002 control_grid[: len(spatial_size)] += _offset
2003 return control_grid # type: ignore
2004
2005
2006class Resample(Transform):

Callers

nothing calls this directly

Calls 4

randomizeMethod · 0.95
fall_back_tupleFunction · 0.90
create_control_gridFunction · 0.90
convert_to_dst_typeFunction · 0.90

Tested by

no test coverage detected