Re: Finding the mean of a set of images [message #32623 is a reply to message #32589] |
Mon, 28 October 2002 01:06   |
mfeldt
Messages: 4 Registered: October 2002
|
Junior Member |
|
|
Hi Dave,
it's not easy to find an entirely array based solution for this.
for me, i found that it helps a great deal in speed if i collapse the
cube to two dimensions and then have a loop run over only *one*
dimension (instead of two nested loops, which are really slow in
idl). the additional advantage is, that in this context you can do
all sorts of things to your cube besides mean and sd - like median,
certain percentiles, etc...
looks somewhat like this:
InArr = fltarr(sx, sy, n) ; this is the input array
OutArr = fltarr(sx*sy)
UseArr = reform(InArr, sx*sy, n)
for i=0l, sx*sy-1 do $
OutArr[i]=median(InArr[i,*]) ; in this case, computes the median
; can stuff other operations here
OutArr=reform(OutArr,sx,sy,/over)
have fun with it ....
mfeldt
--
Markus Feldt Voice: +49 6221 528 262
Max-Planck-Institut Fax: +49 6221 528 246
fA�r Astronomie mailto:mfeldt@mpia.de
KA�nigstuhl 17 http://www.mpia.de/homes/feldt
D-69117 Heidelberg, Germany Si, !asi es la vida!
David Oesch <oesch@giub.unibe.ch> wrote in message news:<3DB51012.6070200@giub.unibe.ch>...
> Hello outthere,
>
> I know this topic was up before, but all I could find in the list was to
> go for CALL_EXTERNAL and use a FORTRAN etc. program. Here's my problem:
> Does anyone have an algorithm for finding the mean/standardeviation etc
> at each pixel position for a set of equal size 2-D images? Currently the
> only way I have to do this is to extract all the values for a given
> pixel position into a 1-D array and find the mean/standardeviation etc
> on that. Doing it pixel by pixel like this is inefficient in IDL so I am
> looking for an *array* based algorithm that would find all
> the mean/standardeviation etc in parallel.
> Any progs so far in IDL for this problem?..or a decent fortran or C program?
>
> Cheers...
>
> Dave
>
> --
> _________________________________________________
>
> David Oesch - Remote Sensing Research Group
>
> Department of Geography
>
> University of Bern Tel : +41 (0)31 631 8020
> Hallerstr. 12 Fax : +49 (0)89 2443 43780
> CH - 3012 Bern Mail: David.Oesch@giub.unibe.ch
> Switzerland http://www.giub.unibe.ch/remsen
>
> Remote Sensing is...
> Staying as far away from the problem as possible.
> - G. Archer, World Bank
> _________________________________________________
|
|
|