How to use the dijkstra3d.dijkstra function in dijkstra3d

To help you get started, we’ve selected a few dijkstra3d examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github seung-lab / kimimaro / kimimaro / trace.py View on Github external
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

dijkstra3d

Implementation of Dijkstra's Shortest Path algorithm on 3D images.

GPL-3.0
Latest version published 4 months ago

Package Health Score

63 / 100
Full package analysis

Similar packages