Skip to content

Commit

Permalink
fix: find_objects doesn't work with arbitrarily large IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
william-silversmith committed Jan 31, 2024
1 parent 55ecb93 commit a8d6b2d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions kimimaro/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,17 @@ def cross_sectional_area(
else:
total = len(skeletons)

all_slices = find_objects(all_labels)
cc_labels, remapping = compute_cc_labels(all_labels)
all_slices = find_objects(cc_labels)
del all_labels

for skel in tqdm(iterator, desc="Labels", disable=(not progress), total=total):
label = skel.id

if label == 0:
continue

label = remapping[label]
slices = all_slices[label - 1]
if slices is None:
continue
Expand All @@ -90,7 +93,7 @@ def cross_sectional_area(
if roi.volume() <= 1:
continue

binimg = np.asfortranarray(all_labels[slices] == label)
binimg = np.asfortranarray(cc_labels[slices] == label)

all_verts = (skel.vertices / anisotropy).round().astype(int)
all_verts -= roi.minpt
Expand Down

0 comments on commit a8d6b2d

Please sign in to comment.