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

Home » Public Forums » archive » Can this be done using array operations instead?
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: Can this be done using array operations instead? [message #66118 is a reply to message #65921] Thu, 02 April 2009 08:58 Go to previous message
Juggernaut is currently offline  Juggernaut
Messages: 83
Registered: June 2008
Member
On Apr 2, 10:34 am, robintw <r.t.wil...@rmplc.co.uk> wrote:
> Hi,
>
> I'm quite new to IDL and I've written a function to calculate some
> statistics for an image file in ENVI. The function has to be
> calculated for the 3x3 square around every pixel in the image. At the
> moment I'm using a couple of nested for loops to do that - is there a
> way to do it using array operations instead?
>
> What I suppose I'm asking for is a way to call a particular function
> for every element of an array - is that possible. I know it's possible
> to do NewArray = OldArray * 2, which is calling the + function on
> every element of the array, but is there a way to call my user-defined
> function on each element?
>
> I can post code if that would help.
>
> Cheers,
>
> Robin

I don't know exactly what "function" you're wanting to perform on
these pixels but CONVOL will operate in such a way.
IDL> x = indgen(3,3)
IDL> print, convol(x, [[1,1,1],[1,0,1],[1,1,1]], /center)
0 0 0
0 32 0
0 0 0

This will add up the surrounding pixels giving you the value as the
new center pixel...don't know if that's helpful but enjoy.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: simultaneous use of multiple font on a postscript file
Next Topic: Re: highlight text in text widget

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

Current Time: Thu Oct 09 20:30:54 PDT 2025

Total time taken to generate the page: 1.20431 seconds