skimage 0.17.2

ParametersReturnsBackRef
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.

Parameters

start : array-like, shape (N,)

The start coordinates of the line.

stop : array-like, shape (N,)

The end coordinates of the line.

endpoint : bool, optional

Whether to include the endpoint in the returned line. Defaults to False, which allows for easy drawing of multi-point paths.

integer : bool, optional

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.

Returns

coords : tuple of arrays

The coordinates of points on the line.

Draw a single-pixel thick line in n dimensions.

Examples

This example is valid syntax, but we were not able to check execution
>>> lin = line_nd((1, 1), (5, 2.5), endpoint=False)
... lin (array([1, 2, 3, 4]), array([1, 1, 2, 2]))
This example is valid syntax, but we were not able to check execution
>>> im = np.zeros((6, 5), dtype=int)
... 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]])
This example is valid syntax, but we were not able to check execution
>>> 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 :

Back References

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

Local connectivity graph

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


File: /skimage/draw/draw_nd.py#54
type: <class 'function'>
Commit: