Image-Py / sknw

build net work from skeleton image (2D-3D)
BSD 3-Clause "New" or "Revised" License
217 stars 47 forks source link

How to do Find Path? #15

Open StefanBaar opened 3 years ago

StefanBaar commented 3 years ago

The example in the Readme file shows an example for finding a path between selected nodes, but there is no description. How can I find the pixel between two nodes or more nodes?

yxdragon commented 3 years ago

@StefanBaar hi, you can see the draw demo. sknw return a networkx object, which has some nodes and edges. path = graph[n1][n2] (normal graph) and path = graph[n1][n2][i] (multi graph), then path['pts'] is the pixels on the edge. graph.nodes()[i] is the node, and graph.nodes()[i]['o'] is the node's centriod.

and you can use sknw 's function to find the shortest path between two nodes.

etienne87 commented 3 months ago

hello! where is the draw demo, is it the main of the script? i do not see any dijkstra/ astar call to networkx