From f31193c099205198ece607c59bd61dede56d8348 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Sch=C3=B6nberger?= Date: Mon, 27 May 2013 21:19:25 +0200 Subject: [PATCH] Add example to circle drawing function --- skimage/draw/draw.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/skimage/draw/draw.py b/skimage/draw/draw.py index f262b1c2..72093d7b 100644 --- a/skimage/draw/draw.py +++ b/skimage/draw/draw.py @@ -28,7 +28,6 @@ def ellipse(cy, cx, yradius, xradius, shape=None): May be used to directly index into an array, e.g. ``img[rr, cc] = 1``. - Examples -------- >>> from skimage.draw import ellipse @@ -89,6 +88,25 @@ def circle(cy, cx, radius, shape=None): Notes ----- This function is a wrapper for skimage.draw.ellipse() + + Examples + -------- + >>> from skimage.draw import circle + >>> img = np.zeros((10, 10), dtype=np.uint8) + >>> rr, cc = circle(4, 4, 5) + >>> img[rr, cc] = 1 + >>> img + array([[0, 0, 1, 1, 1, 1, 1, 0, 0, 0], + [0, 1, 1, 1, 1, 1, 1, 1, 0, 0], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 0], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 0], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 0], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 0], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 0], + [0, 1, 1, 1, 1, 1, 1, 1, 0, 0], + [0, 0, 1, 1, 1, 1, 1, 0, 0, 0], + [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8) + """ return ellipse(cy, cx, radius, radius, shape)