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

Home » Public Forums » archive » Re: Calculate the mean of many images
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: Calculate the mean of many images [message #63623] Mon, 17 November 2008 06:35 Go to previous message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
On Nov 16, 9:57 am, Jeremy Bailin <astroco...@gmail.com> wrote:
> On Nov 16, 1:16 am, Bulrush <Wasit.Weat...@gmail.com> wrote:
>
>
>
>> Hello,
>> I know this topic has been posted several times. But I could not find
>> my answer from these posted.
>> My issue is: I have many images 2 bands in each, one image is QA image
>> and the other one is data.
>> I need to calculate the mean of good pixels. Let's say QA image tells
>> me the location of good pixels, e.g. 1 for good pixels, and other for
>> bad. There are also NaN values. So, if the pixels are "good" in 7
>> images out of ten, then
>> (pixel1+pixel2...+Pixel7) /7
>
>> How can I do that?
>
>> Thanks any advice!
>
>> Elkunn
>
> I'm going to assume that qa and image are both nx x ny x nimage
> arrays, and qa is 1 for good, 0 for bad.
>
> ngoodpix = total(qa, 3)
> imagesum = total(image * qa, 3)
> meanimage = imagesum/ngoodpix
>
> -Jeremy.

Sorry, that doesn't deal with the NaNs properly... and you said that
qa can have other values than 1? How about this:

ngoodpix = total(qa ne 0, 3)
imagesum = total(image*finite(image)*(qa ne 0), 3)
meanimage = imagesum/ngoodpix

-Jeremy.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL and sqlite
Next Topic: A Simple IDL Manifesto

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

Current Time: Wed Oct 08 19:22:40 PDT 2025

Total time taken to generate the page: 0.00439 seconds