circularity#

circularity(domain, population=None, include_boundaries=None, exclude_boundaries=None, boundary_exclude_distance=0, add_as_label=True, label_name='Circularity', cmap='viridis')#

Returns the circularity of shape objects in the domain. Circularity is defined as (4*pi*Area)/(perimeter^2), where 1 represents a perfect circle and values close to 0 represent very irregular shapes. Adds results as a label if required.

Parameters:
domainobject

The domain containing the objects whose circularity is to be calculated.

populationquery-like, optional

The query to select specific objects. Can be of types query, list, tuple, array, or int. Defaults to None.

include_boundariesarray-like, query-like, or None, optional

Boundaries to include in the analysis. Defaults to None.

exclude_boundariesarray-like, query-like, or None, optional

Boundaries to exclude from the analysis. Defaults to None.

boundary_exclude_distancefloat, optional

Buffer to exclude objects located within boundary_exclude_distance from the boundaries. Defaults to 0.

add_as_labelbool, optional

Whether to add the circularity results as a label to the domain. Defaults to True.

label_namestr, optional

The name of the label to be added. Defaults to ‘Circularity’.

cmapstr, optional

The colormap to be used if adding labels. Defaults to ‘viridis’.

Returns:
circularitylist

A list of circularity values for the selected objects.

object_indiceslist

A list of indices of the objects for which circularity was calculated.