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

Home » Public Forums » archive » Re: make a vector from all pixels in a moving window
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: make a vector from all pixels in a moving window [message #74526] Sat, 22 January 2011 16:28 Go to previous message
envi35@yahoo.ca is currently offline  envi35@yahoo.ca
Messages: 48
Registered: March 2005
Member
On Jan 22, 6:59 pm, Robin Wilson <ro...@rtwilson.com> wrote:
> Hi Jenny,
>
> I use the function below to do this for me. It might not be the most
> efficient way of doing it (my IDL code is often lacking in terms of
> efficiency), but it works:
>
> FUNCTION GET_LOCAL_SUBSET, n, x, y, arr
>    ; This gets the local n x n window around the given x and y values
>    ; It will repeat edge values as needed to provide the correctly sized
>    ; return array
>    ;
>    ; Altered fromhttp://michaelgalloy.com/2006/10/10/local
>    ; grid-points.html (Original Author: Michael Galloy)
>    ;
>    ; Calculate the offsets
>    offsets = lindgen(n) - (n - 1) / 2
>
>    ; Calculate the offsets from the given x and y values
>    xoffsets = reform(rebin(offsets, n, n), n^2)
>    yoffsets = reform(rebin(offsets, n^2), n^2)
>
>    return, reform(arr[x + xoffsets, y + yoffsets],n,n)
> END
>
> See Michael's blog post (linked in the comments above) for more
> information on how it works.
>
> Hope this helps,
>
> Robin

This is just what I need! Thanks! Robin
[Message index]
 
Read Message
Read Message
Previous Topic: make a vector from all pixels in a moving window
Next Topic: Re: Making a 64 bit DLM

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

Current Time: Fri Oct 10 06:19:59 PDT 2025

Total time taken to generate the page: 1.51507 seconds