Skip to content

Commit

Permalink
fix: incorrect procedure for mapping segments
Browse files Browse the repository at this point in the history
  • Loading branch information
william-silversmith committed Feb 1, 2024
1 parent 6465fd0 commit 2d42093
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions kimimaro/utility.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from typing import Dict, Union, List

import copy

import numpy as np
import scipy.ndimage
from tqdm import tqdm
Expand Down Expand Up @@ -74,11 +72,8 @@ def cross_sectional_area(
else:
total = len(skeletons)

cc_labels, remapping = compute_cc_labels(all_labels)
remapping = { v:k for k,v in remapping.items() }

all_slices = find_objects(cc_labels)
del all_labels
all_labels, remapping = fastremap.renumber(all_labels, in_place=True)
all_slices = find_objects(all_labels)

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

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

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

0 comments on commit 2d42093

Please sign in to comment.