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

Home » Public Forums » archive » Re: speed-up computation of kernel-based "statistics"
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: speed-up computation of kernel-based "statistics" [message #79871] Wed, 18 April 2012 18:50
ben.bighair is currently offline  ben.bighair
Messages: 221
Registered: April 2007
Senior Member
On Wednesday, April 18, 2012 5:28:28 AM UTC-4, lbusett wrote:
> Hi all,
>
> I have two large (20000*20000 ) images. The first one is a
> classification, with discrete values from 1 to 10, while the second
> one contains values of a variable of interest. For each pixel, I have
> to compute the 5th and the 95th percentile of the values of the
> variable in a 801*801 window (centered on the selected pixel), for the
> pixels of the same class of the center pixel.
>

Hi,

It looks like you are doing a lot of ordering and sorting - IDL's histogram function can really help you here. Let's call the two 801x801 subsets "class" and "data".

; first compute the histogram of your class info.
; Make sure that you are using the data type of 'class' to define min and max.
h = histogram(class, min = 1, max = 10, reverse_indices = ri)

; now use David Fanning's REVERSE_INDICES to get the pixel locations for pixels
; that have the same class as your 'selected pixel'
selectedPixel = 3 ; suppose your center pixel is class=3

; the histogram bin values were specified as 1,2,3,4, ... 10 which means the
; selected pixel class value can be used as an index into the histogram
idx = reverse_indices(ri, selectedPixel - 1, count = n)

; I think n has to be at least one (for the selected pixel)

; now collect those pixels from your 'data' subset - they'll have the same pixel
; addresses
d = data[idx]


I don't have IDL in front of me just now so I could have botched part of it. From here your next step is to order d and find your quantiles. I'm a bit fuzzy on this part but maybe something like this...

ds = d[sort(d)]
ix = n*[0.05, 0.95] ; n is from above, the count of elements in d
p = ds[ix] ; so p should have the values for 5th and 95th quantiles.


Cheers,
Ben
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Reverse engineering the new graphics PLOT() margin property?
Next Topic: reading in tab-separated string data

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

Current Time: Wed Oct 08 11:45:08 PDT 2025

Total time taken to generate the page: 0.00484 seconds