
Hello Ivo, on my machine (Macbook Pro 15) the updates for the example images are interactive. You click in the image once, then the algorithm calculates the shrotest path to every point under mouse while you move the mouse around the image. When you click your mouse for the second time, the last shortest path prediction is saved and displayed over the image. You can then continue moving your mouse and the notebook will keep computing the shortest pathes, until you press Escape key. I am surprised that this has not worked at your machine. Have you tried first with the example image? The code in the notebook is an illustration of the livewire algorithm *principle*. The Python package I propose for inclusion in scikit-image is located under: https://github.com/pdyban/livewire/tree/master/livewire. The test where you can see how the package can be called is here: https://github.com/pdyban/livewire/blob/master/test.py. For example: from livewire import LiveWireSegmentation
from skimage import dataimage = data.coins()
algorithm = LiveWireSegmentation(image) path = algorithm.compute_shortest_path(from_, to_)
More examples can be found in the documentation: http://livewire-segmentation.readthedocs.org/en/latest/ Please let me know if these links answer your questions! I would be happy to contribute my Python package to skimage! Best regards, Pavlo On Wednesday, 2 March 2016 13:15:20 UTC+1, Ivo Flipse wrote:
Hi Pavlo,
Using just Matplotlib GUI, there's not much you can do, since it's rather limited. But I reckon Stéfan's problems arose from the fact that updates made to the window are really slow, so you don't see what the algorithm is doing while you're clicking around. Or at least it didn't do that for me. You could make the logic you execute inside the mouse events available as functions, so people can just pass (mouse) coordinates to your functions and get back coordinates to draw (whichever way they like). That way people can easily integrate your code in whatever GUI they use (an Jupyter Notebook widget would be awesome).
If you want to improve your own GUI code, you could figure out how to get it to draw a bit more often, so you get more feedback. If you click, perhaps leave a marker and then regularly draw the resulting contour. I'd expect that if I click another time, it would at least draw the line it calculated between those two points. In my experience with livewire tools, such as TurtleSeg, you want to add "checkpoints" where you manually specify points where the contour should pass through. Without regular visual feedback, it's hard to judge whether you need one or not.
Still thanks for sharing the code, I hadn't expected such a simple implementation would already work so well
Ivo