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 
Switch to threaded view of this topic Create a new topic Submit Reply
Creating a composite image, avoid fill data values [message #65136] Fri, 13 February 2009 08:30 Go to next message
Matt[1] is currently offline  Matt[1]
Messages: 23
Registered: December 2006
Junior Member
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.
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.
  Switch to threaded view of this topic Create a new topic Submit Reply
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: Sat Oct 11 15:51:26 PDT 2025

Total time taken to generate the page: 2.16070 seconds