Skip to content

Commit

Permalink
fix(cross_section): handle case where skeleton is not present in seg
Browse files Browse the repository at this point in the history
  • Loading branch information
william-silversmith committed Jul 30, 2024
1 parent 63704e6 commit 3baf6b6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions kimimaro/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ def shape_iterator(all_labels, skeletons, fill_holes, in_place, progress, fn):
if label == 0:
continue

if label not in remapping:
continue

label = remapping[label]
slices = all_slices[label - 1]
if slices is None:
Expand Down Expand Up @@ -243,6 +246,12 @@ def cross_sectional_area_helper(skel, binimg, roi):
cross_sectional_area_helper
)

for skel in skeletons.values():
if not hasattr(skel, "cross_sectional_area"):
skel.cross_sectional_area = np.full(len(skel.vertices), -1, dtype=np.float32, order="F")
if not hasattr(skel, "cross_sectional_area_contacts"):
skel.cross_sectional_area_contacts = np.zeros(len(skel.vertices), dtype=np.uint8, order="F")

return skeletons

def oversegment(
Expand Down

0 comments on commit 3baf6b6

Please sign in to comment.