[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: pixel coordinates of a line
Alex Schuster writes:
> Another method would be drawing a real line via PLOTS (preferably in the
> Z buffer), use TVRD() to get this screen part, use WHERE() to get the
> indices of this line, and again image[index] is the information you
> seek.
Oddly, I've had occasion to use this method in the past
week or so and I want to mention one little caveat.
I was trying to quantitate the length of a "contact"
between two adjoining "blobs". The "contact" shows
up (more or less) as a line on an image.
But since I wanted to measure the length of this
line, I needed the pixels in order, from one end
to the other. WHERE doesn't give you this. Nor
does the very useful routine THIN, which has the
wonderful property of identifying the endpoints
of the line for you. (Nor does SEARCH2D return
ordered pixels, which was another non-productive
thought I had.)
So, if you want a line segment, you will have
to write a little routine to sort the pixels
out for yourself. My routine starts at one of
the endpoints and finds the next closest pixel,
etc. It may not be the fastest algorithm, but
it worked well for me.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155