mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-04 13:14:23 +08:00
Merge pull request #1314 from SalvatoreScaramuzzino/RectTool_docs
Rect tool docs
This commit is contained in:
@@ -200,3 +200,6 @@
|
||||
|
||||
- Matěj Týč
|
||||
Extended the image labelling implementation so it also works on 3D images.
|
||||
|
||||
- Salvatore Scaramuzzino
|
||||
RectTool example
|
||||
@@ -37,8 +37,35 @@ class RectangleTool(CanvasToolBase, RectangleSelector):
|
||||
----------
|
||||
extents : tuple
|
||||
Rectangle extents: (xmin, xmax, ymin, ymax).
|
||||
"""
|
||||
|
||||
Examples
|
||||
----------
|
||||
>>> from skimage import data
|
||||
>>> 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: +SKIP
|
||||
|
||||
>>> def print_the_rect(extents):
|
||||
... 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.ax, on_enter=print_the_rect) # doctest: +SKIP
|
||||
>>> viewer.show() # doctest: +SKIP
|
||||
"""
|
||||
|
||||
def __init__(self, viewer, on_move=None, on_release=None, on_enter=None,
|
||||
maxdist=10, rect_props=None):
|
||||
self._rect = None
|
||||
|
||||
Reference in New Issue
Block a user