fishtank.seg.polygons_to_masks

fishtank.seg.polygons_to_masks#

fishtank.seg.polygons_to_masks(polygons, bounds, shape, id='cell', z='z')#

Convert polygons to segmentation masks.

Parameters:
  • polygons (GeoDataFrame) – A GeoDataFrame of polygons.

  • bounds (list) – The total bounds in the polygons coordinate system.

  • shape (tuple) – The shape of the resulting masks in the form (Z,X,Y) or (X,Y).

  • id (str (default: 'cell')) – The name of the id column in the polygons GeoDataFrame

  • z (str (default: 'z')) – The name of the z column in the polygons GeoDataFrame

Return type:

ndarray

Returns:

masks a numpy array with specified shape.