line_nd(start, stop, *, endpoint=False, integer=True)
The line produced will be ndim-connected. That is, two subsequent pixels in the line will be either direct or diagonal neighbours in n dimensions.
The start coordinates of the line.
The end coordinates of the line.
Whether to include the endpoint in the returned line. Defaults to False, which allows for easy drawing of multi-point paths.
Whether to round the coordinates to integer. If True (default), the returned coordinates can be used to directly index into an array. :None:None:`False`
could be used for e.g. vector drawing.
The coordinates of points on the line.
Draw a single-pixel thick line in n dimensions.
>>> lin = line_nd((1, 1), (5, 2.5), endpoint=False)This example is valid syntax, but we were not able to check execution
... lin (array([1, 2, 3, 4]), array([1, 1, 2, 2]))
>>> im = np.zeros((6, 5), dtype=int)This example is valid syntax, but we were not able to check execution
... im[lin] = 1
... im array([[0, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 0, 0]])
>>> line_nd([2, 1, 1], [5, 5, 2.5], endpoint=True) (array([2, 3, 4, 4, 5]), array([1, 2, 3, 4, 5]), array([1, 1, 2, 2, 2]))See :
The following pages refer to to this document either explicitly or contain code examples using this.
skimage.draw.draw_nd.line_nd
skimage.draw.draw_nd._round_safe
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them