MCPcopy Create free account
hub / github.com/KerenLab/CellSighter / cell_shape_aug

Function cell_shape_aug

data/transform.py:23–33  ·  view source on GitHub ↗

Augment the mask of the cell size by dilating the size of the cell with random kernel

(x)

Source from the content-addressed store, hash-verified

21
22
23def cell_shape_aug(x):
24 """
25 Augment the mask of the cell size by dilating the size of the cell with random kernel
26 """
27 if np.random.random() < 0.5:
28 cell_mask = x[:, :, -1]
29 kernel_size = np.random.choice([2, 3, 5])
30 kernel = np.ones(kernel_size, np.uint8)
31 img_dilation = cv2.dilate(cell_mask, kernel, iterations=1)
32 x[:, :, -1] = img_dilation
33 return x
34
35
36def env_shape_aug(x):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected