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

Function poisson_sampling

data/transform.py:8–20  ·  view source on GitHub ↗

Augmentation that resample the data from poisson distribution. Args: x: (H,W,C) when C is th number of markers + 2. (one for the mask of the cell. one for the mask of all the other cells in the environment) Returns: Augmented tensor size of (H,W,C) resampled fro

(x)

Source from the content-addressed store, hash-verified

6
7
8def poisson_sampling(x):
9 """
10 Augmentation that resample the data from poisson distribution.
11 Args:
12 x: (H,W,C) when C is th number of markers + 2. (one for the mask of the cell.
13 one for the mask of all the other cells in the environment)
14
15 Returns:
16 Augmented tensor size of (H,W,C) resampled from poisson distribution.
17 """
18 blur = cv2.GaussianBlur(x[:, :, :-2], (5, 5), 0)
19 x[:, :, :-2] = np.random.poisson(lam=blur, size=x[:, :, :-2].shape)
20 return x
21
22
23def cell_shape_aug(x):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected