bundles / skimage latest / skimage / graph / _mcp / MCP / find_costs
function
skimage.graph._mcp:MCP.find_costs
Signature
def find_costs ( self , starts , ends = None , find_all_ends = True , max_coverage = 1.0 , max_cumulative_cost = <DEPRECATED> , max_cost = <DEPRECATED> , * , max_step_cost = None ) Summary
Find the minimum-cost path from the given starting points.
Extended Summary
This method finds the minimum-cost path to the specified ending indices from any one of the specified starting indices. If no end positions are given, then the minimum-cost path to every position in the costs array will be found.
Parameters
starts: iterableA list of n-d starting indices (where n is the dimension of the
costsarray). The minimum cost path to the closest/cheapest starting point will be found.ends: iterable, optionalA list of n-d ending indices.
find_all_ends: bool, optionalIf 'True' (default), the minimum-cost-path to every specified end-position will be found; otherwise the algorithm will stop when a a path is found to any end-position. (If no
endswere specified, then this parameter has no effect.)max_step_cost: float, optionalCost limit for each step between points. Costs higher than this will form a barrier.
Returns
cumulative_costs: ndarraySame shape as the
costsarray; this array records the minimum cost path from the nearest/cheapest starting index to each index considered. (Ifendswere specified, not all elements in the array will necessarily be considered: positions not evaluated will have a cumulative cost of inf. Iffind_all_endsis 'False', only one of the specified end-positions will have a finite cumulative cost.)traceback: ndarraySame shape as the
costsarray; this array contains the offset to any given index from its predecessor index. The offset indices index into theoffsetsattribute, which is a array of n-d offsets. In the 2-d case, if offsets[traceback[x, y]] is (-1, -1), that means that the predecessor of [x, y] in the minimum cost path to some start position is [x+1, y+1]. Note that if the offset_index is -1, then the given index was not considered.
Other Parameters
max_cost: DEPRECATEDDeprecated in favor of
max_step_cost.max_cumulative_cost: DEPRECATEDmax_cumulative_costis deprecated.
Aliases
-
skimage.graph.MCP.find_costs