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

Home » Public Forums » archive » Re: 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
Re: Creating a composite image, avoid fill data values [message #65134] Fri, 13 February 2009 09:26
Spon is currently offline  Spon
Messages: 178
Registered: September 2007
Senior Member
On Feb 13, 4:30 pm, 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.

Hi Matt,

here's how I would go about it:

1) Create a stack of the images (e.g. Stack = [ [[img1]],
[[img2]], ...), and set all your zeroes to 1 (with the > operator).
Then multiply up stack contents in 3rd dimension with PRODUCT.

2) Now all you need to know is what denominator to divide each cell by
to get your average, and divide your two arrays to get the average in
each pixel.
GoodInd = Where(Stack GT 1)
Mask = Intarr(Size(Stack,/Dim))
Mask[GoodInd] = 1
Denominator = Total(Mask, 3)
AvImg = StackProduct / Denominator

Good luck!
Chris
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Supervised Classification: How to set a pixel's color according to the ROI's color?
Next Topic: What are the memory limitations of 64-bit IDL?

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

Current Time: Wed Oct 08 15:17:05 PDT 2025

Total time taken to generate the page: 0.17129 seconds