profile_line function

Juan Nunez-Iglesias jni.soma at gmail.com
Tue Feb 23 18:15:11 EST 2016


Hi Jaime,

It's a bit confusing, but, because profile_line is used in interactive
tools, *the final point is included in the line*, unlike normal
Python/NumPy indexing. It would be unintuitive in interactive tools *not*
to include the final point. (This is in the "Notes" section in the
docstring.) So, your final point, (0, 10), is actually outside your image,
and the constant value of 0 is returned. I suspect that for your use case
you want to call profile_line(img, (0, 0), (0, 9)) and profile_line(img,
(0, 0), (9, 9)). I think it should work as expected in those cases.

I hope that helps!

Juan.

On Wed, Feb 24, 2016 at 1:33 AM, Jaime Lopez Carvajal <jalopcar at gmail.com>
wrote:

> Hi,
>
> I would like to know why the function profile_line from profile.py in
> module skimage.measure, always return an additional value (zero value) at
> the end for horizontal and vertical lines, and two extra values (2 zeros)
> for diagonal lines.
> I mean, if I have an image 10x10, and I want the profile line
>
> > a = profile_line(img, (0, 0), (0, 10))
> > array([  83.,   82.,   81.,   88.,   95.,   88.,   93.,  107.,  121.,
>  146.,   * 0.*])
>
> and with diagonal lines it returns two additional values (2 zeros), like
> this:
>
> > a = profile_line(img, (0, 0), (10, 10))
> > array([  83.,   92.,  105.,  123.,  100.,   69.,   46.,   46.,   48.,
> 52.,   62.,   70.,   77.,   84.,    *0.,    0.*])
>
> Thanks in advance for your comments,
>
> Jaime
>
> --
> You received this message because you are subscribed to the Google Groups
> "scikit-image" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to scikit-image+unsubscribe at googlegroups.com.
> To post to this group, send email to scikit-image at googlegroups.com.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/scikit-image/d4e6af4a-b4de-49b1-9e57-6391e17dcb9b%40googlegroups.com
> <https://groups.google.com/d/msgid/scikit-image/d4e6af4a-b4de-49b1-9e57-6391e17dcb9b%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20160224/c304db31/attachment.html>


More information about the scikit-image mailing list