Add line thickness for draw module functions

Maik Riechert maik.riechert at arcor.de
Thu Sep 11 07:59:04 EDT 2014


Hi,

I'm a bit surprised that the coordinate functions in the draw module don't 
have a thickness parameter. Is there some other way of thickening the 
lines? Otherwise they are only of very limited use, aren't they?

Also, in addition to the polygon function there should be a function for 
polylines. In the meantime I hacked something together but it's not ideal:

def polyline(poly):
    """
    use skimage.draw.line repeatedly to build all pixels that belong to a 
polyline
        
    :param poly: (n,2) ndarray of (y,x) pairs
    :rtype: rr, cc : (m,) ndarray of int
            Indices of pixels that belong to the polyline. 
    """        
    rrs, ccs = [], []
    for i in range(poly.shape[0]-1):
        y = poly[i,0]
        x = poly[i,1]
        y2 = poly[i+1,0]
        x2 = poly[i+1,1]
        rr, cc = skimage.draw.line(y,x,y2,x2)
        rrs.append(rr)
        ccs.append(cc)
    # this will contain duplicates, but shouldn't be an issue
    rr = np.concatenate(rrs)
    cc = np.concatenate(ccs)
    return rr,cc

Cheers
Maik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20140911/9039e6db/attachment.html>


More information about the scikit-image mailing list