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

Home » Public Forums » archive » Re: Rapid "moving windows" access in IDL?
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: Rapid "moving windows" access in IDL? [message #37846 is a reply to message #37845] Thu, 29 January 2004 20:33 Go to previous messageGo to previous message
mchinand is currently offline  mchinand
Messages: 66
Registered: September 1996
Member
In article <BC3EF6CE.18DB4%greenberg@ucdavis.edu>,
Jonathan Greenberg <greenberg@ucdavis.edu> wrote:
> I'm trying to code a semivariance measure to analyze an image in IDL. Since
> the call requires extracting data from a matrix a certain distance away from
> the center pixel, is there a fast way of coding IDL to extract these
> locations, or is am I doomed to have a very slow algorithm. Basic gist:
>
> For a given pixel/matrix location, subtract off the value of the pixels
> surrounding that pixel:
>
> For pixel at A is at x,y
> B at x-1,y
> C at x+1,y
>
> Semivariance = ((A-B)^2 + (A-C)^2)/4
>
> Any suggestions?
>
> --j
>

I'm not sure if this will be faster, but one option is to create B and C
arrays using SHIFT:

B=shift(A,-1,0)
C=shift(B,1,0)

sv= ((A-B)^2 + (A-C)^2)/4

Obviously, this method is more memory intensive than looping through
A. The edge values probably won't be what you want either.

--Mike



--
Michael Chinander
m-chinander@uchicago.edu
Department of Radiology
University of Chicago
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Memory Headache II
Next Topic: Incremental variable names?

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

Current Time: Thu Oct 16 08:38:37 PDT 2025

Total time taken to generate the page: 0.24083 seconds