diff --git a/skimage/measure/profile.py b/skimage/measure/profile.py index 9dbc2d7a..473b4113 100644 --- a/skimage/measure/profile.py +++ b/skimage/measure/profile.py @@ -15,7 +15,8 @@ def profile_line(img, src, dst, linewidth=1, src : 2-tuple of numeric scalar (float or int) The start point of the scan line. dst : 2-tuple of numeric scalar (float or int) - The end point of the scan line. + The end point of the scan line. The destination point is *included* + in the profile, in constrast to standard numpy indexing. linewidth : int, optional Width of the scan, perpendicular to the line order : int in {0, 1, 2, 3, 4, 5}, optional @@ -44,11 +45,16 @@ def profile_line(img, src, dst, linewidth=1, [0, 0, 0, 0, 0, 0]]) >>> profile_line(img, (2, 1), (2, 4)) array([ 1., 1., 2., 2.]) + >>> profile_line(img, (1, 0), (1, 6), cval=4) + array([ 1., 1., 1., 2., 2., 2., 4.]) - Notes - ----- The destination point is included in the profile, in contrast to standard numpy indexing. + For example: + >>> profile_line(img, (1, 0), (1, 6)) # The final point is out of bounds + array([ 1., 1., 1., 2., 2., 2., 0.]) + >>> profile_line(img, (1, 0), (1, 5)) # This accesses the full first row + array([ 1., 1., 1., 2., 2., 2.]) """ perp_lines = _line_profile_coordinates(src, dst, linewidth=linewidth) if img.ndim == 3: