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

Home » Public Forums » archive » Re: sorting of a multi-dimensional array in only one "direction"/dimension
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: sorting of a multi-dimensional array in only one "direction"/dimension [message #41906 is a reply to message #41902] Thu, 02 December 2004 07:46 Go to previous messageGo to previous message
Timm Weitkamp is currently offline  Timm Weitkamp
Messages: 66
Registered: August 2002
Member
Today at 15:19 +0100, Benjamin Luethi wrote:

> I have (let's say) 5 images in an array imgs=uintarr(1024,1024,5).
> I'd like to average pixel values over the 5 images, but only use the
> central three values of each position while discarding the minimum and
> maximum value.
>
> So far, I'm looping through all image positions (1024x1024!) [...]

There may be better ways, but this here does the job without a loop
(assuming you have IDL 5.6 or higher):

tot = TOTAL(imgs, 3)
min = MIN(imgs, DIMENSION=3)
max = MAX(imgs, DIMENSION=3)
avg = (tot - min - max) / 3.0

Cheers,
Timm

--
Timm Weitkamp <http://people.web.psi.ch/weitkamp>
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: IDL and Intel's 64-bit Xeon processor
Next Topic: Re: IDL and Intel's 64-bit Xeon processor

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

Current Time: Sun Oct 12 14:04:09 PDT 2025

Total time taken to generate the page: 7.51833 seconds