pre_graph_3D#

crispy.pruning.pruning.pre_graph_3D(labelisofil, branch_properties, interpts, ends, w=0.0)[source]#

Convert 3D skeletons into graph representations with weighted edges.

This function generates graph representations of 3D skeletons where nodes represent end points and intersection points, and edges represent branches. Edge weights are calculated using branch lengths and intensities.

Parameters:
  • labelisofil (list of ndarray) – A list of 3D labeled skeleton arrays, where branches are labeled with unique integers, and intersection points are removed.

  • branch_properties (dict) – A dictionary containing properties of the branches, with the following keys: - length: List of branch lengths. - intensity: List of average intensities for each branch.

  • interpts (list of list of ndarray) – Intersection points for each skeleton, with each entry containing the coordinates of pixels belonging to an intersection.

  • ends (list of ndarray) – Endpoints for each skeleton.

  • w (float, optional, default=0.0) – Weighting factor for branch lengths and intensities in edge weight calculation. Must be between 0.0 (length-only weighting) and 1.0 (intensity-only weighting).

Returns:

  • edge_list (list) – List of edges in the graph. Each edge is represented as a tuple: (node_1, node_2, edge_properties), where edge_properties includes branch length and intensity.

  • nodes (list) – List of all nodes in the graph, including endpoints and intersection points.

  • loop_edges (list) – List of loop edges (edges connecting two intersection nodes through multiple branches).

Notes

  • Nodes corresponding to intersection points are labeled alphabetically. For graphs with more than 26 intersections, labels extend to AA, AB, etc.

  • The path_weighting function calculates edge weights using both length and intensity, with the relative contribution controlled by w.

  • This code is based on the 2D version seen in FilFinder (v1.7.2) by Eric Koch.

Raises:

ValueError – If w is not between 0.0 and 1.0.