Fix aliasing and update docstring

This commit is contained in:
blink1073
2014-02-04 21:59:39 -06:00
parent 07f64b443a
commit c2fd471c55
2 changed files with 8 additions and 3 deletions
+3 -2
View File
@@ -78,8 +78,9 @@ def _line_profile_coordinates(src, dst, linewidth=1):
Returns
-------
return_value : array
The coordinates of the profile along the scan line. The length of the profile is the ceil of the computed length of the scan line. The array is of the form (2, length, linewidth).
coords : array, shape (2, N, C), float
The coordinates of the profile along the scan line. The length of the
profile is the ceil of the computed length of the scan line.
Notes
-----
+5 -1
View File
@@ -159,7 +159,11 @@ class LineProfile(PlotPlugin):
if width > 1:
rp, cp = measure.profile._line_profile_coordinates(
*end_points[:, ::-1], linewidth=width)
line_image[rp.astype(int), cp.astype(int)] = 128
# the points are aliased, so create a polygon using the corners
yp = np.rint(rp[[0, 0, -1, -1],[0, -1, -1, 0]]).astype(int)
xp = np.rint(cp[[0, 0, -1, -1],[0, -1, -1, 0]]).astype(int)
rp, cp = draw.polygon(yp, xp, line_image.shape)
line_image[rp, cp] = 128
(x1, y1), (x2, y2) = end_points.astype(int)
rr, cc = draw.line(y1, x1, y2, x2)
line_image[rr, cc] = 255