main_length_3D#

crispy.pruning.pruning.main_length_3D(max_path, edge_list, labelisofil, interpts, branch_lengths, img_scale, verbose=False, save_png=False, save_name=None)[source]#

Compute the main lengths of 3D skeletons and generate longest path arrays.

This function calculates the overall lengths of skeletons in a 3D image by identifying and preserving the longest paths. Intersections are added back to the skeletons, and extraneous pixels introduced by intersections are removed.

Parameters:
  • max_path (list) – List of paths corresponding to the longest lengths for each skeleton.

  • edge_list (list) – List of edges representing connectivity information for the skeleton graphs.

  • labelisofil (list of ndarray) – List of 3D labeled skeleton arrays. Each array contains skeleton branches with unique integer labels and no intersection points.

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

  • branch_lengths (list) – Lengths of individual branches in each skeleton.

  • img_scale (float) – Conversion factor from pixel units to physical units.

  • verbose (bool, optional, default=False) – If True, prints detailed information about the process (currently disabled for 3D).

  • save_png (bool, optional, default=False) – If True, saves 2D visualizations of the skeletons (disabled for 3D).

  • save_name (str, optional, default=None) – Name for saving output PNGs (currently unused for 3D).

Returns:

  • main_lengths (list) – List of overall lengths for each skeleton, in physical units.

  • longpath_arrays (ndarray) – Binary 3D array representing the longest paths for all skeletons. Non-zero values indicate pixels belonging to the longest paths.

Notes

  • Intersections are added back to the skeleton, and extraneous pixels are removed using a recursive pruning process.

  • The max_path input determines the longest path in each skeleton.

  • This function is adapted from the 2D main_length function in FilFinder and includes modifications for 3D structures.

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