Re: Apply function to bunch of images and save answer and read ...in text files?? [message #54136] |
Fri, 18 May 2007 08:03 |
Vince Hradil
Messages: 574 Registered: December 1999
|
Senior Member |
|
|
On May 18, 9:44 am, "rpert...@gmail.com" <rpert...@gmail.com> wrote:
> Hi,
> This is fairly an easy problem that I unfortunately do not know the
> answer to. So here goes:
>
> I have a bunch of images. 6 sets of 10 repeated images. I need to
> calculate the mean and variance of 1 pixel in each set and plot them.
> I know how to read each pixel and obtain mean and variance. The
> question I have is handling all these files as they are separate. I
> have right now, calculated my mean and variance and saved them in a
> separate folder as .sav file for each set. Then I am trying to find
> all .sav files in that folder and restore them to be able to plot
> them. There's the hic. Restoring does not work, and I am pretty sure,
> I should not be saving as .sav, but not sure how else to save and
> retrieve this data.
> Any thoughts?
> Thanks,
> rp
Let's see. First off the mean and variance of one pixel is going to
be pretty trivial...
But kidding aside, I guess you mean the mean and variance across the
10 replicates for each of the 6 sets, separately. How about this:
<begin psuedo-code>
mean_image = array(nx,ny)
var_image = array(nx,ny)
iset = array(nx,ny,10)
for s=0, 5 do
for r=0, 9 iset[*,*,r] <- image[s,r]
for jj=0, ny-1 do
for ii=0, nx-1 do
mean_image[ii,jj,s] = mean(iset[ii,jj,*],sdev=sdval)
var_image[ii,jj,s] = sdval*sdval
endfor
endfor
write mean_image ; as bmp, jpeg, png, raw (i.e. writeu)
write var_image
endfor
<end>
Cheers!
|
|
|