Module: viewer.canvastools

LineTool

class skimage.viewer.canvastools.LineTool(ax, on_move=None, on_release=None, on_enter=None, maxdist=10, line_props=None)

Bases: skimage.viewer.canvastools.base.CanvasToolBase

Widget for line selection in a plot.

Parameters:

ax : matplotlib.axes.Axes

Matplotlib axes where tool is displayed.

on_move : function

Function called whenever a control handle is moved. This function must accept the end points of line as the only argument.

on_release : function

Function called whenever the control handle is released.

on_enter : function

Function called whenever the “enter” key is pressed.

maxdist : float

Maximum pixel distance allowed when selecting control handle.

line_props : dict

Properties for matplotlib.lines.Line2D.

Attributes

end_points
__init__(ax, on_move=None, on_release=None, on_enter=None, maxdist=10, line_props=None)
end_points
geometry
on_mouse_press(event)
on_mouse_release(event)
on_move(event)
update(x=None, y=None)

PaintTool

class skimage.viewer.canvastools.PaintTool(ax, overlay_shape, radius=5, alpha=0.3, on_move=None, on_release=None, on_enter=None, rect_props=None)

Bases: skimage.viewer.canvastools.base.CanvasToolBase

Widget for painting on top of a plot.

Parameters:

ax : matplotlib.axes.Axes

Matplotlib axes where tool is displayed.

overlay_shape : shape tuple

2D shape tuple used to initialize overlay image.

alpha : float (between [0, 1])

Opacity of overlay

on_move : function

Function called whenever a control handle is moved. This function must accept the end points of line as the only argument.

on_release : function

Function called whenever the control handle is released.

on_enter : function

Function called whenever the “enter” key is pressed.

rect_props : dict

Properties for matplotlib.patches.Rectangle. This class redefines defaults in matplotlib.widgets.RectangleSelector.

Attributes

overlay
label
__init__(ax, overlay_shape, radius=5, alpha=0.3, on_move=None, on_release=None, on_enter=None, rect_props=None)
geometry
label
on_mouse_press(event)
on_mouse_release(event)
on_move(event)
overlay
radius
shape
update_cursor(x, y)
update_overlay(x, y)

RectangleTool

class skimage.viewer.canvastools.RectangleTool(ax, on_move=None, on_release=None, on_enter=None, maxdist=10, rect_props=None)

Bases: skimage.viewer.canvastools.base.CanvasToolBase, matplotlib.widgets.RectangleSelector

Widget for selecting a rectangular region in a plot.

After making the desired selection, press “Enter” to accept the selection and call the on_enter callback function.

Parameters:

ax : matplotlib.axes.Axes

Matplotlib axes where tool is displayed.

on_move : function

Function called whenever a control handle is moved. This function must accept the rectangle extents as the only argument.

on_release : function

Function called whenever the control handle is released.

on_enter : function

Function called whenever the “enter” key is pressed.

maxdist : float

Maximum pixel distance allowed when selecting control handle.

rect_props : dict

Properties for matplotlib.patches.Rectangle. This class redefines defaults in matplotlib.widgets.RectangleSelector.

Attributes

extents Return (xmin, xmax, ymin, ymax).
__init__(ax, on_move=None, on_release=None, on_enter=None, maxdist=10, rect_props=None)
corners

Corners of rectangle from lower left, moving clockwise.

edge_centers

Midpoint of rectangle edges from left, moving clockwise.

extents

Return (xmin, xmax, ymin, ymax).

geometry
onmove(event)
press(event)
release(event)

ThickLineTool

class skimage.viewer.canvastools.ThickLineTool(ax, on_move=None, on_enter=None, on_release=None, on_change=None, maxdist=10, line_props=None)

Bases: skimage.viewer.canvastools.linetool.LineTool

Widget for line selection in a plot.

The thickness of the line can be varied using the mouse scroll wheel, or with the ‘+’ and ‘-‘ keys.

Parameters:

ax : matplotlib.axes.Axes

Matplotlib axes where tool is displayed.

on_move : function

Function called whenever a control handle is moved. This function must accept the end points of line as the only argument.

on_release : function

Function called whenever the control handle is released.

on_enter : function

Function called whenever the “enter” key is pressed.

on_change : function

Function called whenever the line thickness is changed.

maxdist : float

Maximum pixel distance allowed when selecting control handle.

line_props : dict

Properties for matplotlib.lines.Line2D.

Attributes

end_points
__init__(ax, on_move=None, on_enter=None, on_release=None, on_change=None, maxdist=10, line_props=None)
on_key_press(event)
on_scroll(event)