I get the impression that you are keeping a statistic for the mean and variance on each pixel coordinate in 10 "repeated images". And that you are calculating 6 such sets of statistics, because you have 6 sets of 10 repeated images. In the end, I am guessing you want a plot of two 6-element arrays for any given pixel coordinate, one showing the mean, the other showing the variance.
So, assuming that you have a block of 10 images in 1 set, let's say all 360 x 360 in size, organized as a 3D image cube array, e.g. 'myimages' with dimensions of 360 x 360 x 10, then you might get your mean and variance in this way:
meansArray = total(myimages, 3) / 10.0
subtractorArray = fltarr(360, 360, 10)
for i = 0, 9 do subractorArray[0,0,i] = meansArray
variances = abs(myimages - subtractorArray)
help, variances
;VARIANCES FLOAT = Array[360, 360, 10]
averageVariances = total(variances, 3) / 10.0
help, averageVariances
;AVERAGEVARIANCES FLOAT = Array[360, 360]
I now assume that you are want to store 'meansArray' and 'averageVariances' in the file system on your hard drive. Using an IDL-formatted '.sav' file should be easy. The only downside to using the '.sav' file approach is if you are using the same code to process each of your 6 image cubes. In that scenario, you run the likelihood of having in each of your 6 output '.sav' files the same variable name assigned to arrays that have divergent values. If you later were in a loop that looked like this:
for i = 0, 5 do restore, 'my_means_and_variances' + strtrim(i, 2) + '.sav'
You would have the same two variables 'meansArray' and 'averageVariances' being overwritten during every iteration of the 6-cycle loop. However, the following approach WOULD work with '.sav' files.
myMeansPlotData = fltarr(360, 360, 6)
myVariancesPlotData = fltarr(360, 360, 6)
for i = 0, 5 do begin
restore, 'my_means_and_variances' + strtrim(i, 2) + '.sav'
myMeansPlotData[0,0,i] = meansArray
myVariancesPlotData[0,0,i] = averageVariances
endfor
In the above approach, each dataset is stored persistently as a "slice" in a new 3D array.
Now, the results at any given coordinate can be easily plotted with code like:
myCoord = [100, 40]
plot, myMeansPlotData[myCoord[0], mycoord[1], *]
James Jones
|