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

Method random_idx

monai/utils/ordering.py:193–207  ·  view source on GitHub ↗
(rows: int, cols: int, depths: int | None = None)

Source from the content-addressed store, hash-verified

191
192 @staticmethod
193 def random_idx(rows: int, cols: int, depths: int | None = None) -> np.ndarray:
194 idx: list[tuple] = []
195
196 for r in range(rows):
197 for c in range(cols):
198 if depths:
199 for d in range(depths):
200 idx.append((r, c, d))
201 else:
202 idx.append((r, c))
203
204 idx_np = np.array(idx)
205 np.random.shuffle(idx_np)
206
207 return idx_np

Callers

nothing calls this directly

Calls 2

arrayMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected