Module ImportFrom alias ImportFrom alias Import alias identifier Assign NameStore ListLoad Str FunctionDef arguments args NameParam NameParam defaults Str body Expr Str If CompareNotEq AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Assign NameStore CompareNotEq NameLoad Num Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr If CompareEq AttributeLoad NameLoad attr Num body Assign SubscriptStore NameLoad Index NameLoad BinOpAdd BinOpMult Call NameLoad AttributeLoad NameLoad attr BinOpPow Call NameLoad AttributeLoad NameLoad attr Num Num Expr Call AttributeLoad NameLoad attr NameLoad NameLoad orelse Expr Call AttributeLoad NameLoad attr BinOpMult AttributeLoad NameLoad attr Num Assign NameStore Call AttributeLoad NameLoad attr ListComp Num comprehension NameStore AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad If CompareEq NameLoad Str body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Return NameLoad decorator_list
N/A N/A _distance N/A _morph N/A numpy np N/A __all__ N/A distance distance N/A N/A bw metric N/A euclidean2 N/A N/A 
    dmap = distance(bw, metric='euclidean2')

    Computes the distance transform of image `bw`::

        dmap[i,j] = min_{i', j'} { (i-i')**2 + (j-j')**2 | !bw[i', j'] }

    That is, at each point, compute the distance to the background.

    If there is no background, then a very high value will be returned in all
    pixels (this is a sort of infinity).

    Parameters
    ----------
    bw : ndarray
        If boolean, ``False`` will denote the background and ``True`` the
        foreground. If not boolean, this will be interpreted as ``bw != 0``
        (this way you can use labeled images without any problems).
    metric : str, optional
        one of 'euclidean2' (default) or 'euclidean'

    Returns
    -------
    dmap : ndarray
        distance map

    References
    ----------
    For 2-D images, the following algorithm is used:

    Felzenszwalb P, Huttenlocher D. *Distance transforms of sampled functions.
    Cornell Computing and Information.* 2004.

    Available at:
    http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.88.1647&rep=rep1&type=pdf.

    For n-D images (with n > 2), a slower hand-craft method is used.
     N/A N/A N/A bw dtype N/A np bool_ N/A N/A bw N/A bw 0 N/A f N/A N/A np zeros N/A bw shape N/A np double N/A N/A N/A bw ndim 2 N/A N/A N/A f N/A bw N/A N/A N/A len N/A f shape N/A N/A max N/A f shape 2 1 N/A N/A N/A _distance dt f None N/A N/A N/A N/A f fill N/A N/A f size 2 N/A Bc N/A N/A np ones N/A 3 N/A _ N/A bw shape bool N/A N/A N/A _morph distance_multi f bw Bc N/A N/A metric euclidean N/A N/A N/A N/A np sqrt f f N/A f N/A