SyMBac.misc

SyMBac.misc.get_sample_images()[source]

Return a dict of sample mother machine images.

Returns

A dict with sample images, current keys are: “E. coli 100x”, “E. coli 100x stationary”, “E. coli DeLTA”

Return type

dict

SyMBac.misc.resize_mask(mask, resize_shape, ret_label)[source]

Resize masks while maintaining their connectivity and values

Parameters
  • mask (np.ndarray) – Input mask

  • resize_shape (tuple(int, int)) – Shape to resize the mask to

  • ret_label (bool) – Whether to return labeled or bool masks

Returns

Resized mask

Return type

np.ndarray

SyMBac.misc.unet_weight_map(y, wc=None, w0=10, sigma=5)[source]

Generate weight maps as specified in the U-Net paper for boolean mask.

Parameters
  • mask (Numpy array) – 2D array of shape (image_height, image_width) representing binary mask of objects.

  • wc (dict) – Dictionary of weight classes.

  • w0 (int) – Border weight parameter.

  • sigma (int) – Border width parameter.

Returns

Training weights. A 2D array of shape (image_height, image_width).

Return type

Numpy array

References

Taken from the original U-net paper 1

1

Ronneberger, O., Fischer, P., Brox, T. (2015). U-Net: Convolutional Networks for Biomedical Image Segmentation. In: Navab, N., Hornegger, J., Wells, W., Frangi, A. (eds) Medical Image Computing and Computer-Assisted Intervention – MICCAI 2015. MICCAI 2015. Lecture Notes in Computer Science(), vol 9351. Springer, Cham. https://doi.org/10.1007/978-3-319-24574-4_28