classify_structure#
- crispy.pruning.pruning.classify_structure(skeleton)[source]#
Classify the components of a skeleton into labeled branches, intersections, and endpoints.
This function processes a binary skeleton array, identifies its endpoints and intersection points, and removes intersections to separate individual branches. It returns labeled arrays for the branches and lists of intersection points and endpoints.
- Parameters:
skeleton (ndarray) – Binary array representing the skeletonized structure. Non-zero values indicate skeleton points, and zero values represent the background.
- Returns:
labelisofil (list of ndarray) – List of labeled arrays, where each array corresponds to a skeleton with intersections removed, and branches are labeled with unique integers.
interpts (list of list of tuple) – List of intersection points for each skeleton, with each intersection containing the coordinates of pixels belonging to it.
ends (list of list of tuple) – List of endpoint coordinates for each skeleton.
Notes
The function uses 8-connectivity for 2D skeletons and maximum connectivity for higher dimensions to label individual structures.
Endpoints are identified using the endPoints function.
Intersection points are labeled separately, and their coordinates are stored in interpts.
Branches are labeled after removing intersections from the skeleton.
This code is based on the 2D version seen in FilFinder (v1.7.2) by Eric Koch.