From 0994d80d4e49b13e7a41d70ebf7df6d2e90e4f12 Mon Sep 17 00:00:00 2001 From: Zachary Pincus Date: Fri, 7 Jan 2011 08:08:54 -0500 Subject: [PATCH] allow negative-cost elements --- scikits/image/graph/_mcp.pyx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scikits/image/graph/_mcp.pyx b/scikits/image/graph/_mcp.pyx index 47c704fc..e06f0d91 100644 --- a/scikits/image/graph/_mcp.pyx +++ b/scikits/image/graph/_mcp.pyx @@ -210,6 +210,9 @@ cdef class MCP: `costs` array at each point on the path. The class MCP_Geometric, on the other hand, accounts for the fact that diagonal vs. axial moves are of different lengths, and weights the path cost accordingly. + + Array elements with infinite or negative costs will simply be ignored, as + will paths whose cumulative cost overflows to infinite. Parameters ---------- @@ -241,8 +244,6 @@ cdef class MCP: See class documentation. """ costs = np.asarray(costs) - if costs.min() < 0: - raise ValueError('minimum cost must be positive') if not np.can_cast(costs.dtype, FLOAT): raise TypeError('cannot cast costs array to ' + str(FLOAT))