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

Home » Public Forums » archive » avoiding for loops
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
avoiding for loops [message #13445] Thu, 12 November 1998 00:00 Go to previous message
lbryanNOSPAM is currently offline  lbryanNOSPAM
Messages: 21
Registered: July 1998
Junior Member
I've had such good luck recently with y'all that I thought I'd send
another one. Although this is a little less esoteric. I need to
apply a median filter all the way to the edges of an image. So I came
up with putting an edge around it the width of the filter then
selecting out the original region. Sort of what convol does
automatically.

The following code is what I came up with. It works, but it is clunky
as heck. I know some of you guys are wizzes at getting rid of loops.
Care to lend a hand?

p.s. the data I'm working on array 4000x512 arrays not 100x100!


Thanks!!!

n = 3
bottshade = shift(dist(100),10)+randomu(100,100,100)*5.
azrange = 100
shotrange = 100
temp = fltarr(shotrange +2*n,azrange + 2*n)
temp(n,n) = bottshade
for i = 0,shotrange -1 +2*n do begin
temp(i,0:n-1) = temp(i,n)
temp(i,azrange-1+n:azrange-1+2*n) = temp(i,azrange +n - 2)
endfor
for i = 0,azrange -1 +2*n do begin
temp(0:n-1,i) = temp(n,i)
temp(shotrange-1+n:shotrange-1+2*n,i) = temp(shotrange +n - 2,i)
endfor
temp2 = median(temp,n)
bottshade = temp(n:n+shotrange-1,n:n+azrange)

end

Lisa
Arete Associates
Tucson, Arizona
lbryan@arete-az.com
[Message index]
 
Read Message
Read Message
Previous Topic: Re: Installing IDL 6.1 on debian linux 3
Next Topic: () and execution speed

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

Current Time: Wed Oct 08 15:22:20 PDT 2025

Total time taken to generate the page: 0.00399 seconds