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

Home » Public Forums » archive » Re: efficient comparing 1D and 3D arrays
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: efficient comparing 1D and 3D arrays [message #60680 is a reply to message #60679] Wed, 11 June 2008 09:37 Go to previous messageGo to previous message
Jean H. is currently offline  Jean H.
Messages: 472
Registered: July 2006
Senior Member
>>> At the moment I am trying to find pixels that fall within a certain
>>> value range for each pixel, as part of a recursive image exploration
>>> routine.
>>> Say I have the following data:
>>> imgdata = fltarr(NB, NS, NL)
>>> MinVals = fltarr(NB)
>>> MaxVals = fltarr(NB)
>>> Now I would like to efficiently find out
>>> where( (imgdata GT MinVals) and (imgdata LT MaxVals) )
>> There are two possibilities. One is to REFORM/REBIN your MinVals and
>> MaxVals arrays so they are the same dimension as imgdata, then you can
>> do your comparison directly.

> If I do a rebin on the data, I realize I can do a 'bandwise-
> comparison' or an pixel-based comparison, but I could not do a
> straight 3D comparison, could I?

Hi,
Yes you can...do something like:
nb=3
ns=5
nl=5
imgData = fix(randomu(seed,nb,nl,ns)*100) ;--> doing ns,nl,nb makes
more sense than nb,ns,nl... for mental representation at least (and if
you print it!)

minVals = [15,30,12] ;Min val in each band
maxVals = [75,80,60] ;Max val in each band

allMin = rebin(minVals, nb,nl,ns) ;repeat the min band value for every
pixels in each band
allMax = rebin(maxVals, nb,nl,ns)

goodPixels = where(imgData gt allMin and imgData lt allMax)

==> returns the indexes of imgData that satisfy the condition in EVERY band.

Jean
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: How to add tie point information for ENVI in IDL?
Next Topic: Re: Filling a contour

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

Current Time: Fri Oct 10 19:36:10 PDT 2025

Total time taken to generate the page: 0.33013 seconds