From 42e872f926bb4cf8050d91560a2e9180f5ada79f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Boulogne?= Date: Sun, 24 Mar 2013 15:22:42 +0100 Subject: [PATCH] fix names --- skimage/transform/__init__.py | 4 +-- skimage/transform/hough_transform.py | 2 +- .../transform/tests/test_hough_transform.py | 33 +++++++++---------- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/skimage/transform/__init__.py b/skimage/transform/__init__.py index efe8f0b4..92858010 100644 --- a/skimage/transform/__init__.py +++ b/skimage/transform/__init__.py @@ -1,6 +1,6 @@ -from ._hough_transform import hough_circle, +from ._hough_transform import (hough_circle, hough_line, - probabilistic_hough_line + probabilistic_hough_line) from .hough_transform import * from .radon_transform import * from .finite_radon_transform import * diff --git a/skimage/transform/hough_transform.py b/skimage/transform/hough_transform.py index 0c1747d4..8e680c94 100644 --- a/skimage/transform/hough_transform.py +++ b/skimage/transform/hough_transform.py @@ -1,4 +1,4 @@ -__all__ = ['hough_peaks'] +__all__ = ['hough_line_peaks'] from itertools import izip as zip diff --git a/skimage/transform/tests/test_hough_transform.py b/skimage/transform/tests/test_hough_transform.py index 5e175945..2a2f57d2 100644 --- a/skimage/transform/tests/test_hough_transform.py +++ b/skimage/transform/tests/test_hough_transform.py @@ -3,7 +3,6 @@ from numpy.testing import * import skimage.transform as tf import skimage.transform.hough_transform as ht -from skimage.transform import probabilistic_hough from skimage.draw import circle_perimeter, line @@ -50,7 +49,7 @@ def test_probabilistic_hough(): # decrease default theta sampling because similar orientations may confuse # as mentioned in article of Galambos et al theta = np.linspace(0, np.pi, 45) - lines = probabilistic_hough(img, theta=theta, threshold=10, line_length=10, + lines = tf.probabilistic_hough_line(img, theta=theta, threshold=10, line_length=10, line_gap=1) # sort the lines according to the x-axis sorted_lines = [] @@ -62,59 +61,59 @@ def test_probabilistic_hough(): assert([(25, 25), (74, 74)] in sorted_lines) -def test_hough_peaks(): +def test_hough_line_peaks(): img = np.zeros((100, 150), dtype=int) rr, cc = line(60, 130, 80, 10) img[rr, cc] = 1 out, angles, d = tf.hough_line(img) - out, theta, dist = tf.hough_peaks(out, angles, d) + out, theta, dist = tf.hough_line_peaks(out, angles, d) assert_equal(len(dist), 1) assert_almost_equal(dist[0], 80.723, 1) assert_almost_equal(theta[0], 1.41, 1) -def test_hough_peaks_dist(): +def test_hough_line_peaks_dist(): img = np.zeros((100, 100), dtype=np.bool_) img[:, 30] = True img[:, 40] = True hspace, angles, dists = tf.hough_line(img) - assert len(tf.hough_peaks(hspace, angles, dists, min_distance=5)[0]) == 2 - assert len(tf.hough_peaks(hspace, angles, dists, min_distance=15)[0]) == 1 + assert len(tf.hough_line_peaks(hspace, angles, dists, min_distance=5)[0]) == 2 + assert len(tf.hough_line_peaks(hspace, angles, dists, min_distance=15)[0]) == 1 -def test_hough_peaks_angle(): +def test_hough_line_peaks_angle(): img = np.zeros((100, 100), dtype=np.bool_) img[:, 0] = True img[0, :] = True hspace, angles, dists = tf.hough_line(img) - assert len(tf.hough_peaks(hspace, angles, dists, min_angle=45)[0]) == 2 - assert len(tf.hough_peaks(hspace, angles, dists, min_angle=90)[0]) == 1 + assert len(tf.hough_line_peaks(hspace, angles, dists, min_angle=45)[0]) == 2 + assert len(tf.hough_line_peaks(hspace, angles, dists, min_angle=90)[0]) == 1 theta = np.linspace(0, np.pi, 100) hspace, angles, dists = tf.hough_line(img, theta) - assert len(tf.hough_peaks(hspace, angles, dists, min_angle=45)[0]) == 2 - assert len(tf.hough_peaks(hspace, angles, dists, min_angle=90)[0]) == 1 + assert len(tf.hough_line_peaks(hspace, angles, dists, min_angle=45)[0]) == 2 + assert len(tf.hough_line_peaks(hspace, angles, dists, min_angle=90)[0]) == 1 theta = np.linspace(np.pi / 3, 4. / 3 * np.pi, 100) hspace, angles, dists = tf.hough_line(img, theta) - assert len(tf.hough_peaks(hspace, angles, dists, min_angle=45)[0]) == 2 - assert len(tf.hough_peaks(hspace, angles, dists, min_angle=90)[0]) == 1 + assert len(tf.hough_line_peaks(hspace, angles, dists, min_angle=45)[0]) == 2 + assert len(tf.hough_line_peaks(hspace, angles, dists, min_angle=90)[0]) == 1 -def test_hough_peaks_num(): +def test_hough_line_peaks_num(): img = np.zeros((100, 100), dtype=np.bool_) img[:, 30] = True img[:, 40] = True hspace, angles, dists = tf.hough_line(img) - assert len(tf.hough_peaks(hspace, angles, dists, min_distance=0, + assert len(tf.hough_line_peaks(hspace, angles, dists, min_distance=0, min_angle=0, num_peaks=1)[0]) == 1 -def test_houghcircle(): +def test_hough_circle(): # Prepare picture img = np.zeros((120, 100), dtype=int) radius = 20