Skip to content

Commit 2d42093

Browse files
fix: incorrect procedure for mapping segments
1 parent 6465fd0 commit 2d42093

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

kimimaro/utility.py

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from typing import Dict, Union, List
22

3-
import copy
4-
53
import numpy as np
64
import scipy.ndimage
75
from tqdm import tqdm
@@ -74,11 +72,8 @@ def cross_sectional_area(
7472
else:
7573
total = len(skeletons)
7674

77-
cc_labels, remapping = compute_cc_labels(all_labels)
78-
remapping = { v:k for k,v in remapping.items() }
79-
80-
all_slices = find_objects(cc_labels)
81-
del all_labels
75+
all_labels, remapping = fastremap.renumber(all_labels, in_place=True)
76+
all_slices = find_objects(all_labels)
8277

8378
for skel in tqdm(iterator, desc="Labels", disable=(not progress), total=total):
8479
label = skel.id
@@ -95,7 +90,7 @@ def cross_sectional_area(
9590
if roi.volume() <= 1:
9691
continue
9792

98-
binimg = np.asfortranarray(cc_labels[slices] == label)
93+
binimg = np.asfortranarray(all_labels[slices] == label)
9994

10095
all_verts = (skel.vertices / anisotropy).round().astype(int)
10196
all_verts -= roi.minpt

0 commit comments

Comments
 (0)