mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-21 12:50:27 +08:00
renamed function bresenham to line
This commit is contained in:
@@ -12,7 +12,7 @@ cdef extern from "../morphology/_pnpoly.h":
|
||||
|
||||
@cython.boundscheck(False)
|
||||
@cython.wraparound(False)
|
||||
def bresenham(int y, int x, int y2, int x2):
|
||||
def line(int y, int x, int y2, int x2):
|
||||
"""Generate line pixel coordinates.
|
||||
|
||||
Parameters
|
||||
|
||||
@@ -3,4 +3,4 @@ Methods to draw on arrays.
|
||||
|
||||
"""
|
||||
|
||||
from ._draw import bresenham, polygon, ellipse, circle
|
||||
from ._draw import line, polygon, ellipse, circle
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
from numpy.testing import assert_array_equal
|
||||
import numpy as np
|
||||
|
||||
from skimage.draw import bresenham, polygon, circle, ellipse
|
||||
from skimage.draw import line, polygon, circle, ellipse
|
||||
|
||||
|
||||
def test_bresenham_horizontal():
|
||||
def test_line_horizontal():
|
||||
img = np.zeros((10, 10))
|
||||
|
||||
rr, cc = bresenham(0, 0, 0, 9)
|
||||
rr, cc = line(0, 0, 0, 9)
|
||||
img[rr, cc] = 1
|
||||
|
||||
img_ = np.zeros((10, 10))
|
||||
@@ -15,10 +15,10 @@ def test_bresenham_horizontal():
|
||||
|
||||
assert_array_equal(img, img_)
|
||||
|
||||
def test_bresenham_vertical():
|
||||
def test_line_vertical():
|
||||
img = np.zeros((10, 10))
|
||||
|
||||
rr, cc = bresenham(0, 0, 9, 0)
|
||||
rr, cc = line(0, 0, 9, 0)
|
||||
img[rr, cc] = 1
|
||||
|
||||
img_ = np.zeros((10, 10))
|
||||
@@ -26,10 +26,10 @@ def test_bresenham_vertical():
|
||||
|
||||
assert_array_equal(img, img_)
|
||||
|
||||
def test_bresenham_reverse():
|
||||
def test_line_reverse():
|
||||
img = np.zeros((10, 10))
|
||||
|
||||
rr, cc = bresenham(0, 9, 0, 0)
|
||||
rr, cc = line(0, 9, 0, 0)
|
||||
img[rr, cc] = 1
|
||||
|
||||
img_ = np.zeros((10, 10))
|
||||
@@ -37,10 +37,10 @@ def test_bresenham_reverse():
|
||||
|
||||
assert_array_equal(img, img_)
|
||||
|
||||
def test_bresenham_diag():
|
||||
def test_line_diag():
|
||||
img = np.zeros((5, 5))
|
||||
|
||||
rr, cc = bresenham(0, 0, 4, 4)
|
||||
rr, cc = line(0, 0, 4, 4)
|
||||
img[rr, cc] = 1
|
||||
|
||||
img_ = np.eye(5)
|
||||
|
||||
Reference in New Issue
Block a user