Re: user-selected ROIs [message #72024] |
Wed, 04 August 2010 11:46  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Emily writes:
> The XROI procedure is the first thing I tried, but I don't understand
> how to get the actual values I've already calculated in the histogram.
I don't understand what you mean by "actual values" in the histogram.
A histogram tells you how many values fall into a particular bin of
the histogram. And you can use the reverse indices to tell you which
of the data values contributed to that count, but there are no "values"
per se. You could, of course, use the indices retrieved with
REVERSE_INDICES to go back to the data and obtain the data values.
Is this what you mean?
> This is why I started doing it in a different way. If I just send the
> image, I get the occurrences over 0-255 and if I send the actual data,
> which is an array, I just get a little image that I can't really even
> see.
I think you are confusing the *display* of your image with
the image itself. They are really two completely different
things. The "values" of the image are completely divorced
from the "values" in which the image is displayed, except that
a very small subset of display values (0 to 255) are used to
represent an infinite number of real (image) values. You
are very rarely interested in the display values. In fact,
you may not even know what they are!
> If I send the array of masses, the latitude array, and longitude
> array, I just get three tiny images.
Three tiny images where?
> Do you know how I send XROI the
> real values of the pixels (n-g/m3, not 0-255) and still have it
> displayed as a map?
What does "displayed as a map" mean in this context? Does
it mean you have map grid lines and continental boundaries
on it? XROI doesn't care what you pass it, as long as it
is an 8-bit or 24-bit image. What you are going to get
back from XROI is not the information you are looking
for. Rather, it is the information you need to *retrieve*
the values you are looking for from the original image
data. In other words, what you are looking for is a mask
that you can use to either select the image values you
are interested in, or to select the image values you
are not interested in. Your goal here is to obtain a
mask that you can apply to your real image data that
allows you to work with the right pixels.
I think if you read the first article a couple of times,
and maybe work through the example, you will see what
I mean.
Cheers,
David
P.S. Do you see how the REVERSE_INDICES from the Histogram
are a type of mask to select pixels you are interested in?
--
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.")
|
|
|
Re: user-selected ROIs [message #72025 is a reply to message #72024] |
Wed, 04 August 2010 11:18   |
geogal34
Messages: 6 Registered: August 2010
|
Junior Member |
|
|
On Aug 4, 1:13 pm, David Fanning <n...@dfanning.com> wrote:
> Emily writes:
>> 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!
>
> There are probably a couple of more elegant ways, yes. :-)
>
> Here is one:
>
> http://www.dfanning.com/ip_tips/xroi.html
>
> Here is another:
>
> http://www.dfanning.com/ip_tips/boundary.html
>
> There is even software that mostly does the job for you:
>
> http://www.dfanning.com/ip_tips/blobanalysis.html
>
> 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.")
Hi David,
The XROI procedure is the first thing I tried, but I don't understand
how to get the actual values I've already calculated in the histogram.
This is why I started doing it in a different way. If I just send the
image, I get the occurrences over 0-255 and if I send the actual data,
which is an array, I just get a little image that I can't really even
see. If I send the array of masses, the latitude array, and longitude
array, I just get three tiny images. Do you know how I send XROI the
real values of the pixels (n-g/m3, not 0-255) and still have it
displayed as a map? I guess that's what I really need and just can't
figure out how to do that.
Emily
|
|
|
Re: user-selected ROIs [message #72027 is a reply to message #72025] |
Wed, 04 August 2010 11:00   |
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
|
|
|
|
Re: user-selected ROIs [message #72153 is a reply to message #72024] |
Thu, 05 August 2010 06:01  |
geogal34
Messages: 6 Registered: August 2010
|
Junior Member |
|
|
On Aug 4, 2:46 pm, David Fanning <n...@dfanning.com> wrote:
> Emily writes:
>> The XROI procedure is the first thing I tried, but I don't understand
>> how to get the actual values I've already calculated in the histogram.
>
> I don't understand what you mean by "actual values" in the histogram.
> A histogram tells you how many values fall into a particular bin of
> the histogram. And you can use the reverse indices to tell you which
> of the data values contributed to that count, but there are no "values"
> per se. You could, of course, use the indices retrieved with
> REVERSE_INDICES to go back to the data and obtain the data values.
> Is this what you mean?
>
>> This is why I started doing it in a different way. If I just send the
>> image, I get the occurrences over 0-255 and if I send the actual data,
>> which is an array, I just get a little image that I can't really even
>> see.
>
> I think you are confusing the *display* of your image with
> the image itself. They are really two completely different
> things. The "values" of the image are completely divorced
> from the "values" in which the image is displayed, except that
> a very small subset of display values (0 to 255) are used to
> represent an infinite number of real (image) values. You
> are very rarely interested in the display values. In fact,
> you may not even know what they are!
>
>> If I send the array of masses, the latitude array, and longitude
>> array, I just get three tiny images.
>
> Three tiny images where?
>
>> Do you know how I send XROI the
>> real values of the pixels (n-g/m3, not 0-255) and still have it
>> displayed as a map?
>
> What does "displayed as a map" mean in this context? Does
> it mean you have map grid lines and continental boundaries
> on it? XROI doesn't care what you pass it, as long as it
> is an 8-bit or 24-bit image. What you are going to get
> back from XROI is not the information you are looking
> for. Rather, it is the information you need to *retrieve*
> the values you are looking for from the original image
> data. In other words, what you are looking for is a mask
> that you can use to either select the image values you
> are interested in, or to select the image values you
> are not interested in. Your goal here is to obtain a
> mask that you can apply to your real image data that
> allows you to work with the right pixels.
>
> I think if you read the first article a couple of times,
> and maybe work through the example, you will see what
> I mean.
>
> Cheers,
>
> David
>
> P.S. Do you see how the REVERSE_INDICES from the Histogram
> are a type of mask to select pixels you are interested in?
>
> --
> 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.")
Thanks, David. I've managed to get the mask and indices from the
PolyFillV procedure, now I just have to figure out how to work with
them. I'm not really clear on how to use the REVERSE_INDICES yet, but
I'm playing with it. I always find it hard to translate what I'm doing
on the screen to my actual data (the retrieving part). It's just not
always intuitive to me. Thanks again!
Emily
|
|
|