grains.cad.build_skeleton

grains.cad.build_skeleton(label_image, connectivity=1, detect_boundaries=True)[source]

Builds skeleton connectivity of a label image.

A single-pixel wide network is created, separating the labelled image regions. The resulting network contains information about how the regions are connected.

Parameters
  • label_image (ndarray) – Labeled input image, represented as a 2D numpy array of positive integers.

  • connectivity ({1,2}, optional) – A connectivity of 1 (default) means pixels sharing an edge will be considered neighbors. A connectivity of 2 means pixels sharing a corner will be considered neighbors.

  • detect_boundaries (bool, optional) – When True, the image boundaries will be treated as part of the skeleton. This allows identifying boundary regions in the skeleton2regions function. The default is True.

Returns

skeleton_network (Skeleton) – Geometrical and topological information about the skeleton network of the input image.