Re: chosing points along an image row with mouse [message #25552] |
Tue, 26 June 2001 21:07 |
david[2]
Messages: 100 Registered: June 2001
|
Senior Member |
|
|
Kim Nielsen writes:
> I would like to know if there is a way to get the mouse to only move
> along a row (or column). I have an image and need to pick two points
> along the same row. Is there a way to get the mouse only to move along
> a row ?
You can look at an example like ZPLOT to see
a widget program that draws an arrow along
the initially selected row. This is not the
best program I've ever written, and I write
my event handlers differently now, but it will
give you a place to start anyway. I'm working
with a plot, but you will get the idea I think.
It is much simpler with an image.
You will need these two old programs:
http://www.dfanning.com/programs/zplot.pro
http://www.dfanning.com/programs/getcolor.pro
(ZPLOT allows you to zoom into a line plot.
The arrow is used to show you the extend of the
plot you will be zooming.)
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
|
|
|
Re: chosing points along an image row with mouse [message #25554 is a reply to message #25552] |
Tue, 26 June 2001 15:28  |
Paul van Delst
Messages: 364 Registered: March 1997
|
Senior Member |
|
|
Kim Nielsen wrote:
>
> Hi,
>
> I would like to know if there is a way to get the mouse to only move
> along a row (or column). I have an image and need to pick two points
> along the same row. Is there a way to get the mouse only to move along
> a row ?
why do you want to get the mouse to only to move along a row when what you *really* want
is to pick two points along the same row? :o)
After you have selected row(or column) "mode" in your program (widget button or function
keyword?), the first mouse button click can retrieve the image value at that position, as
well as save the current row(or column) image pixel value, say ysave(or xsave). The next
mouse click at (x,y) will then cause your program to read the image at position (x, ysave)
in row mode or (xsave, y) in column mode. A neato thing would be to turn on a
horizontal(or vertical) bar the width(or height) of your image after the first mouse click
that then moves vertically(or horizontally) as you move the mouse.
I think that this would work (or not :o) with the (gasp!) cursor command too but, despite
the code outlay, a widget approach would be cleaner (and easier too I reckon but YMMV).
paulv
--
Paul van Delst A little learning is a dangerous thing;
CIMSS @ NOAA/NCEP Drink deep, or taste not the Pierian spring;
Ph: (301)763-8000 x7274 There shallow draughts intoxicate the brain,
Fax:(301)763-8545 And drinking largely sobers us again.
Alexander Pope.
|
|
|
|