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

Home » Public Forums » archive » 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
user-selected ROIs [message #72029] Wed, 04 August 2010 09:47 Go to previous message
geogal34 is currently offline  geogal34
Messages: 6
Registered: August 2010
Junior Member
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
[Message index]
 
Read Message
Read Message
Previous Topic: Re: user-selected ROIs
Next Topic: NetCDF 4.0 Support in IDL 8?

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

Current Time: Fri Oct 10 06:07:49 PDT 2025

Total time taken to generate the page: 1.91231 seconds