comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: ENVI: procedure to get X, Y of pixel in displayed image
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: ENVI: procedure to get X, Y of pixel in displayed image [message #52086 is a reply to message #52077] Wed, 27 December 2006 06:53 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
aberte@gmail.com writes:

> i'm getting troubled with writing a procedure to get x,y (so: y = the
> line of the image (row) and x = the sample (column)) coordinates of a
> pixel of a displayed image. I'm trying to do this with cursor, but
> while debugging I don't have the results I want.
>
> I'm using
>
> cursor, x, y, 4, /DATA
>
> I saw that with
> cursor, x, y, 4, /DEVICE
> I get integers instead of floats.
>
> I would to like what I'm doing wrong.

Probably several things. :-)

First of all, you shouldn't be using the CURSOR command
in a widget window. You will probably get *slightly*
wrong values, even if you do everything else right. You
should trap button events from the draw widget in an
event handler.

But even if this CURSOR command worked like you expected
it to, the chances of this doing the right thing are
small, since it would *only* work if there was a one-to-one
correspondence between the size of the window and the
physical size of the image. I think we can assume in a
program like ENVI this will seldom be the case.

To make this work, you pretty much have to have a
way to translate from the window coordinate system
to the image coordinate system. I don't know ENVI,
so I am not sure how this is done there. But I should
think this is such a fundamental property of the way
ENVI *must* handle images that your efforts would be
more handsomely rewarded by searching the ENVI documentation
than by trying to write an IDL program to do it.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: Number of points inside a contour curve
Next Topic: Using value_locate with a non-monotonic vector! And it's working!??!

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 14:43:47 PDT 2025

Total time taken to generate the page: 1.28718 seconds