bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / draw / draw / disk
function
skimage.draw.draw:disk
source: /dev/scikit-image/src/skimage/draw/draw.py :152
Signature
def disk ( center , radius , * , shape = None ) Summary
Generate coordinates of pixels within circle.
Parameters
center: tupleCenter coordinate of disk.
radius: doubleRadius of disk.
shape: tuple, optionalImage shape as a tuple of size 2. Determines the maximum extent of output pixel coordinates. This is useful for disks that exceed the image size. If None, the full extent of the disk is used. The shape might result in negative coordinates and wraparound behaviour.
Returns
rr, cc: ndarray of intPixel coordinates of disk. May be used to directly index into an array, e.g.
img[rr, cc] = 1.
Examples
import numpy as np from skimage.draw import disk shape = (4, 4) img = np.zeros(shape, dtype=np.uint8) rr, cc = disk((0, 0), 2, shape=shape) img[rr, cc] = 1 img img = np.zeros(shape, dtype=np.uint8) rr, cc = disk((0, 0), 2, shape=None) img[rr, cc] = 1 img img = np.zeros((10, 10), dtype=np.uint8) rr, cc = disk((4, 4), 5) img[rr, cc] = 1 img✓
Aliases
-
skimage.draw.disk