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

Home » Public Forums » archive » Creating a composite image, avoid fill data values
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: Creating a composite image, avoid fill data values [message #65180 is a reply to message #65136] Mon, 16 February 2009 16:08 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Feb 13, 11:30 am, Matt <mmsmith1...@gmail.com> wrote:
> Hi - I need to create a composite image showing the mean of all images
> while avoiding the fill value of 0. I have 5 images that are 600 by
> 800. In these images there are fill values interspersed among valid
> values (3-255). I'd like to create a new image showing the mean pixel
> values across all images, but I need to ignore pixels with value of 0
> from the calculations. Any suggestions on how to get this done?
> Thanks.

The stacking method is OK, but in this case a loop with five
iterations will not hurt. Assuming your image is stored in the array
IMAGE(600,800,5),

TOT = fltarr(600,800) ;; Cumulative total image
NSAMP = TOT ;; Number of valid samples per pixel
for i = 0, 4 do begin
nsamp = nsamp + (IMAGE NE 0) ;; Accumulate number of valid pixels
tot = tot + IMAGE ;; Accumulate total
end
mean = (TOT/NSAMP)

Of course you will want to check NSAMP to avoid dividing by zero.
[Message index]
 
Read Message
Read Message
Previous Topic: Re: Different issue
Next Topic: Re: Reading multiple ASCII files in as 2d arrays and putting them into a 3d array

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

Current Time: Fri Oct 10 05:26:08 PDT 2025

Total time taken to generate the page: 0.08171 seconds