Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if len(manual_targets_before) + len(manual_targets_after) >= max_paths:
return []
while (valid_labels > 0 or manual_targets_before or manual_targets_after) \
and len(paths) < max_paths:
if manual_targets_before:
target = manual_targets_before.pop()
elif valid_labels == 0:
target = manual_targets_after.pop()
else:
target = kimimaro.skeletontricks.find_target(labels, DAF)
if fix_branching:
path = dijkstra3d.dijkstra(parents, root, target)
else:
path = dijkstra3d.path_from_parents(parents, target)
if soma_mode:
dist_to_soma_root = np.linalg.norm(anisotropy * (path - root), axis=1)
# remove all path points which are within soma_radius of root
path = np.concatenate(
(path[:1,:], path[dist_to_soma_root > soma_radius, :])
)
if valid_labels > 0:
invalidated, labels = kimimaro.skeletontricks.roll_invalidation_cube(
labels, DBF, path, scale, const,
anisotropy=anisotropy, invalid_vertices=invalid_vertices,
)
valid_labels -= invalidated