Rectangle extents: (xmin, xmax, ymin, ymax).
After making the desired selection, press "Enter" to accept the selection and call the on_enter
callback function.
Skimage viewer or plot plugin object.
Function called whenever a control handle is moved. This function must accept the rectangle extents as the only argument.
Function called whenever the control handle is released.
Function called whenever the "enter" key is pressed.
Maximum pixel distance allowed when selecting control handle.
Properties for matplotlib.patches.Rectangle
. This class redefines defaults in matplotlib.widgets.RectangleSelector
.
Widget for selecting a rectangular region in a plot.
>>> from skimage import dataThis example is valid syntax, but we were not able to check execution
... from skimage.viewer import ImageViewer
... from skimage.viewer.canvastools import RectangleTool
... from skimage.draw import line
... from skimage.draw import set_color
>>> viewer = ImageViewer(data.coffee()) # doctest: +SKIPThis example is valid syntax, but we were not able to check execution
>>> def print_the_rect(extents):This example is valid syntax, but we were not able to check execution
... global viewer
... im = viewer.image
... coord = np.int64(extents)
... [rr1, cc1] = line(coord[2],coord[0],coord[2],coord[1])
... [rr2, cc2] = line(coord[2],coord[1],coord[3],coord[1])
... [rr3, cc3] = line(coord[3],coord[1],coord[3],coord[0])
... [rr4, cc4] = line(coord[3],coord[0],coord[2],coord[0])
... set_color(im, (rr1, cc1), [255, 255, 0])
... set_color(im, (rr2, cc2), [0, 255, 255])
... set_color(im, (rr3, cc3), [255, 0, 255])
... set_color(im, (rr4, cc4), [0, 0, 0])
... viewer.image=im
>>> rect_tool = RectangleTool(viewer, on_enter=print_the_rect) # doctest: +SKIPSee :
... viewer.show() # doctest: +SKIP
The following pages refer to to this document either explicitly or contain code examples using this.
skimage.viewer.canvastools.recttool.RectangleTool
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