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

Home » Public Forums » archive » Re: user-selected ROIs
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: user-selected ROIs [message #72027 is a reply to message #72025] Wed, 04 August 2010 11:00 Go to previous messageGo to previous message
jeanh is currently offline  jeanh
Messages: 79
Registered: November 2009
Member
On 04/08/2010 12:47 PM, geogal34 wrote:
> I have generated an output contour map of masses projected on a map
> and would like to be able to allow the user to select a specific
> region of interest and calculate the mass for that area. Basically I
> just need to add up the value of all the pixels contained within the
> boundary.
>
> I�ve tried using XROI, but haven�t had any luck because the actual
> values (masses) of the pixels aren�t what is shown in the histogram
> when the image is passed. I�ve tried several different ways of passing
> the data, but to no avail.
>
> So I have chosen to draw a polygon point by point using CURSOR, then
> plan to use a WHERE statement to figure out all the pixels within the
> ROI. I use a similar procedure to determine a larger subset of the
> satellite data, but that only has two points. The problem I�m
> encountering is that, while I can print the latitudes and longitudes
> as the mouse is clicked, I can�t seem to save them to an array because
> the x, y positions are constantly being overwritten. What I'm trying
> to do it save the initial array and then add new ones as they are
> created. This code adds new lines to the array, but it just fills it
> with the same points (lat/lon).
>
> ;Drawing polygon point by point
> clicks=0
> CURSOR, x, y, /DOWN, /DATA
> PLOTS, x, y, PSYM=1, /DATA
> WHILE (!MOUSE.button NE 4) DO BEGIN
> CURSOR, x1, y1, /DOWN, /DATA
> PLOTS, [x, x1], [y, y1], /DATA
> ; x=x1& y=y1
> IF (!MOUSE.button EQ 1 OR 4) THEN BEGIN
> clicks=clicks+1
> print, 'Clicks=', clicks, ' ', 'X=',x, ' ', 'Y=', y
> cloud_array=fltarr(2, clicks)
> FOR i=0, clicks-1 DO BEGIN
> cloud_array(0,i)=[x]
> cloud_array(1,i)=[y]
> ENDFOR
> print, 'i=', i
> print, cloud_array
> ENDIF
> x=x1& y=y1
> ENDWHILE
>
> There�s probably a simple solution, but I�ve been going in circles for
> a while and now everything is a jumble in my head. Can anyone point in
> the right direction? Or has anyone been able to do what I�m trying to
> accomplish? I imagine there is probably a more elegant way and I'm not
> even sure if this way makes sense!
>
> Thanks!
> Emily

Hi,

when you do
cloud_array=fltarr(2, clicks)
you just erase all the content of cloud_array. Then, in a loop, you
assign the same value to each entry (for each "click" in your counter).
What you want to do, for this issue (see other posts about elegant ways
of achieving your objective), is to store cloud_array in the Uvalue of
your widget. Then, each time a click occurs, you read this array, add
one row, fill this row with x and y values, and save back cloud_array in
the Uvalue. When done, you can access the whole set of points.

Jean
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: lon-lat coordinates for Geotiff images?
Next Topic: user-selected ROIs

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

Current Time: Wed Oct 08 19:31:55 PDT 2025

Total time taken to generate the page: 0.00206 seconds