init_lengths_3D#

crispy.pruning.pruning.init_lengths_3D(labelisofil, array_offsets=None, img=None, use_skylength=True)[source]#

Compute lengths and intensities for branches in 3D skeletons.

This function calculates the lengths and average intensities of branches in labeled skeletons, accounting for both the full 3D length and the sky-projected length if specified.

Parameters:
  • labelisofil (list of ndarray) – A list of 3D labeled skeleton arrays. Each array contains skeleton branches where intersections have been removed, and branches are labeled with unique integers.

  • array_offsets (list of ndarray, optional, default=None) – Indices specifying where each skeleton array fits in the original image. If None, offsets default to ones.

  • img (ndarray, optional, default=None) – The original 3D intensity image. If provided, the average intensity along each branch is computed. If not provided, the intensity is assumed to be uniform.

  • use_skylength (bool, optional, default=True) – If True, calculates the sky-projected length (ignoring the velocity axis). If False, calculates the full 3D length in PPV space.

Returns:

branch_properties – A dictionary containing the following keys: - length: A list of branch lengths for each skeleton. - intensity: A list of average intensities for each branch. - pixels: A list of pixel coordinates for each branch.

Return type:

dict

Notes

  • Branch lengths are calculated using the walk_through_segment_3D function.

  • Sky-projected lengths are computed by ignoring the velocity axis during length calculation.

  • The function pads branch arrays to prevent edge-related errors during traversal.

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

Raises:

ValueError – If the shape of img does not match the shape of the skeleton arrays in labelisofil.