generate_quadrats#

generate_quadrats(domain, side_length=100, population=None, include_boundaries=None, exclude_boundaries=None, boundary_exclude_distance=0, regions_collection_name='Quadrats', assign_objects_using_labels=True, region_label_name='ROI', remove_empty_regions=True, region_include_method='clip', label_observations=['__all__'], return_IDs=False)#

Generates new objects in the domain that represent quadrats of a given size. The new quadrat objects are added to the domain and labelled with a unique ID. If assign_objects_using_labels is set to True, objects within the quadrats are also labelled with a unique ID.

Parameters:
domainobject

A muspan domain.

side_lengthint, optional

The side length of each edge of a quadrat, by default 100.

populationarray-like, optional

The population of objects to consider, by default None.

include_boundarieslist, np.ndarray or query-like or None, optional

Boundaries to include or None to include all.

exclude_boundarieslist, np.ndarray or query-like or None, optional

Boundaries to exclude or None to exclude none.

boundary_exclude_distanceint, optional

Distance to exclude from boundaries, by default 0.

regions_collection_namestr, optional

The name of the collection to which the quadrats will be added, by default ‘Quadrats’.

assign_objects_using_labelsbool, optional

If True, objects within the quadrats are also labelled with a unique ID, by default True.

region_label_namestr, optional

The name of the label to be added to objects within the quadrats, by default ‘ROI’.

remove_empty_regionsbool, optional

If True, empty quadrats will be removed, by default True.

region_include_methodstr, optional

Method to include regions, either ‘clip’ or ‘partial’. ‘clip’ crops regions to remove parts of the shape outside of the boundary. ‘partial’ includes quadrats that are partially within the boundary. Default is ‘clip’.

label_observationslist, optional

List of labels to observe. If set to [‘__all__’], all labels that are stored in the domain will be observed, by default [‘__all__’]

return_IDsbool, optional

If True, returns the IDs of the quadrats generated, by default False.

Raises:
ValueError

If the region_include_method is not ‘partial’ or ‘clip’, or if the label type is not supported.