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

Home » Public Forums » archive » Re: Getting ROI data from an 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: Getting ROI data from an image [message #77860 is a reply to message #77859] Fri, 30 September 2011 12:41 Go to previous messageGo to previous message
Rebecca is currently offline  Rebecca
Messages: 4
Registered: October 2011
Junior Member
OK, I can see how using the histogram w/ reverse indices will help
quickly get the indices associated with each ROI. That's a great help,
I wouldn't even need a FOR loop.
h = HISTOGRAM(result, MIN = 0, MAX = classes, NBINS = classes+1,
REVERSE_INDICES=ri)

But this doesn't answer the problem I was having, which perhaps I
didn't speak to as directly as I wanted- or perhaps you both are
simply more versed at array indexing than I am! With HISTOGRAM or
WHERE, it returns a 1D index of a 2D array (result), but I need to
pull hyperspectral data from a 3D array using those indexes. My
hyperspectral 'img' array might be 320 x 1000 x 300, for example. I
cannot simply call
temp = img[ ri[ri[1]:ri[2]-1], *]
And get the data I need. How would this be accomplished instead? I
suppose I could use the 1D subscripts and, looping through each
spectral band, get the data one band at a time but this seems tedious
when I would hope an elegant solution would be possible.

As I said, I want the mean spectra for each class (ROI) identified by
K-Means.

Thanks for the help so far,
Rebecca

On Sep 30, 3:19 pm, David Fanning <n...@dfanning.com> wrote:
> Brian J. Daniel writes:
>> Look at using the HISTOGRAM function on the result variable with
>> REVERSE_INDICES keyword.
>
>> http://www.idlcoyote.com/tips/histogram_tutorial.html
>
> Using the Reverse_Indices keyword can often seem
> complicated. You can use the ReverseIndices function
> from the Coyote Library to return the indices to you
> without having to learn the complicated vector in a
> vector syntax:
>
>   http://www.idlcoyote.com/programs/reverseindices.pro
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Multi-Threading in ENVI
Next Topic: finding confidence interval in spectral analysis ( something similar to chi2conf.m in matlab)

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

Current Time: Fri Oct 10 14:46:39 PDT 2025

Total time taken to generate the page: 0.40147 seconds