Dear all,
I've been trying to calculate deviation of each image from the mean at
pixel by pixel basis.
When I checked pixel values, they look to be way high.
I've trying to figure it out, but due to my short knowledge of IDL,
problem solving doesn't seem to progress.
For your better understanding, I would like to show what I wrote.
I really appreciate for your comments and advice.
;-------------------------------------------------------------------------------------------------
pro deviation
file = File_Search('C:\DataProcessing\Images\*.tif', Count=count)
nImages = n_elements(file)
OK = QUERY_TIFF(file[0], info)
print, info.dimensions
imageSize = info.dimensions
ns = imageSize[0]
nl = imageSize[1]
Volume = fltarr(ns, nl, nImages)
imageMean = fltarr(ns, nl) ; stacked image mean
imageDev = fltarr(ns, nl) ; image difference
imageFloat = fltarr(ns, nl) ; converting floating point
FOR i=0, count-1 DO BEGIN
Image = READ_TIFF(file[i])
imageFloat = float(reform(Image))
Volume[*,*,i] = imageFloat
imageMean = total(Volume, 3)/nImages
imageDev = imageFloat - imageMean
FILE_MKDIR, 'C:\DataProcessing\Images\Temp\'
outdir = 'C:\DataProcessing\Images\Temp\'
basename = File_BaseName(file, '.tif')
outfile = outdir + basename + '.dev.dat'
OPENW, LUN, (outfile[i]), /GET_LUN
WRITEU, LUN, imageDev
FREE_LUN, LUN
ENDFOR
END
;----------------------------------------------------------------------------
|
|
0
|
|
|
|
Reply
|
beardown911 (15)
|
7/4/2010 5:00:44 AM |
|
I am not sure, but it seems strange that you're calculating imageMean
inside the loop, as you fill Volume up with images.... so imageMean is
different for each value of i... is that what you want?
I think you want to loop over i and fill Volume all the way. Then:
imageMean = total(Volume, 3)/nImages ;;;<-- nImages is the same as
count, right?
meanVol=rebin(imageMean, ns, nl, count)
devVol=Volume-meanVol
then write each slice of devVol out to a file...
but I could have misunderstood what you want to do...
G
|
|
0
|
|
|
|
Reply
|
Gianguido
|
7/4/2010 5:46:31 AM
|
|
On Jul 4, 12:46=A0am, Gianguido Cianci <gianguido.cia...@gmail.com>
wrote:
> I am not sure, but it seems strange that you're calculating imageMean
> inside the loop, as you fill Volume up with images.... so imageMean is
> different for each value of i... is that what you want?
>
> I think you want to loop over i and fill Volume all the way. Then:
>
> imageMean =3D total(Volume, 3)/nImages =A0 =A0 ;;;<-- nImages is the same=
as
> count, right?
> meanVol=3Drebin(imageMean, ns, nl, count)
> devVol=3DVolume-meanVol
>
> then write each slice of devVol out to a file...
>
> but I could have misunderstood what you want to do...
>
> G
Hi Gianguido,
Thanks for your suggestion.
But I've got exactly same results though.
I've calculated few files using envi bandmath individually, and the
bandmath seems to give right values.
I will keep studying what's wrong on my code is.
Thanks,
Hojin
|
|
0
|
|
|
|
Reply
|
go
|
7/6/2010 3:52:08 AM
|
|
|
2 Replies
444 Views
(page loaded in 0.117 seconds)
|