Create circular mask

tomni.make_mask.make_mask_circle(img_shape: tuple, diameter: int) numpy.ndarray[source]

Create a boolean image with a circle of True surrounded by False.

Parameters
  • img_shape (tuple) – The shape of the image given in image coordinates, represented as (width, height).

  • diameter (int) – The diameter of the circle in pixels.

Returns

A boolean image where the area enclosed by the circle is True and the rest is False.

Return type

np.ndarray

Note

  • The function uses either ‘make_small_mask_circle’ or ‘make_big_mask_circle’ based on the size of the circle.

  • In case the diameter is greater than or equal to 100 pixels, the ‘make_big_mask_circle’ function is used for memory efficiency.