[scikit-image] Help with MCP.goal_reached() in graph module

Spencer Gardner spencergardner at gmail.com
Tue May 2 13:14:18 EDT 2017


The skimage.graph documentation states that the goal_reached method can be
overloaded to introduce additional constraints on finding the minimum cost
path. I'm having some trouble implementing this but I can't find any useful
examples to follow online. I'm hoping someone can provide some guidance.

I need to implement a minimum cost path through an array of costs. The
added twist is that I need to ensure the path does not exceed some maximum
geometric distance (represented as a total number of traversed cells). So I
need my goal_reached() method to check whether the current path has
exceeded the maximum number of cells and return 1 if true (which tells MCP
to stop checking neighbors).

Is there a good example implementation somewhere that I can refer to for
some guidance? I've sketched out a rough outline but I'm not sure I'm on
the right track:

graph = MCP(costSurfaceArray,fully_connected=False)

def goal_reached(index, cumcost):
   '''code to check total distance'''

graph.goal_reached = goal_reached

Thanks for any help!

PS I posted this also on a Google Group that appears to be defunct.
Apologies if that list is actually active and you got a double post from me.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20170502/41428425/attachment.html>


More information about the scikit-image mailing list