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

Method __init__

monai/transforms/intensity/array.py:1855–1869  ·  view source on GitHub ↗
(self, num_control_points: tuple[int, int] | int = 10, prob: float = 0.1)

Source from the content-addressed store, hash-verified

1853 backend = [TransformBackends.TORCH, TransformBackends.NUMPY]
1854
1855 def __init__(self, num_control_points: tuple[int, int] | int = 10, prob: float = 0.1) -> None:
1856 RandomizableTransform.__init__(self, prob)
1857
1858 if isinstance(num_control_points, int):
1859 if num_control_points <= 2:
1860 raise ValueError("num_control_points should be greater than or equal to 3")
1861 self.num_control_points = (num_control_points, num_control_points)
1862 else:
1863 if len(num_control_points) != 2:
1864 raise ValueError("num_control points should be a number or a pair of numbers")
1865 if min(num_control_points) <= 2:
1866 raise ValueError("num_control_points should be greater than or equal to 3")
1867 self.num_control_points = (min(num_control_points), max(num_control_points))
1868 self.reference_control_points: NdarrayOrTensor
1869 self.floating_control_points: NdarrayOrTensor
1870
1871 def interp(self, x: NdarrayOrTensor, xp: NdarrayOrTensor, fp: NdarrayOrTensor) -> NdarrayOrTensor:
1872 ns = torch if isinstance(x, torch.Tensor) else np

Callers

nothing calls this directly

Calls 3

minFunction · 0.85
maxFunction · 0.85
__init__Method · 0.45

Tested by

no test coverage detected