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 #77859 is a reply to message #77858] Fri, 30 September 2011 13:41 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Rebecca Brown writes:

> 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 think you need one more step:

s = Size(result, /DIMENSIONS)
h = Histogram(result, ....., REVERSE_INDICES=ri)
indices = ReverseIndices(ri, 1) ; As an example.
colrow = Array_Indices(s, indices, /DIMENSIONS)
x = Reform(colrow[0,*])
y = Reform(colrow[1,*])
temp = img[x,y,*]

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: Sat Oct 11 06:03:39 PDT 2025

Total time taken to generate the page: 0.56457 seconds