# Temporal processing of image stack

19 views (last 30 days)
Ian Blum on 10 Jun 2012
Hello,
Not super familiar with the image toolbox in Matlab and we was wondering if there was an easy way to use arithmetic operations (or something similar) to process a time-series of still images that are currently in a tiff stack.
Briefly, we have some relatively noisy images and would like to run a filter which uses temporal information to remove the random noise. Since the nearest neighbour images i.e. the one before and the one after, should be almost identical, in terms of the actual image (but not the noise) we were thinking that by comparing two images and then plotting the lowest value of the two for each pixel we would be able to eliminate the random noise will preserving the real data (with only a minor dimming of the image itself). We would then run this as a recursive filter so that it would happen for each image in the stack (except the last of course) and then resave the tiff file with a suffix or some such attached.
The question now is, can this be coded simply in Matlab? and were should I begin in terms of resources to figure this out?
Thanks to anyone taking the time to read and help us out.
##### 2 CommentsShowHide 1 older comment
Ashish Uthama on 11 Jun 2012
Are all the images in the stack of the same still scene? If so, consider using MEAN (http://www.mathworks.com/help/techdoc/ref/mean.html). You can ask MEAN to work on the third dimension.

Geoff on 10 Jun 2012
Well, I'm not known for my solutions that take advantage of inbuilt MatLab functions... Maybe something like filter would be useful, but here... Assuming mono images (ie 3rd dimension is the frame number)
nframes = zeros( size(frames) - [0,0,1] );
for f = 1:size(nframes,3)
nframes(:,:,f) = min( frames(:,:,f), frames(:,:,f+1);
end
That would do your min-filtering on two frames... One thing I would try is to take 3 frames (f + [-1,0,1]), choose the centre value of the three. Could probably just take advantage of sort() here, which would be about as efficient as doing comparisons manually...
nframes = zeros(size(frames)); % Keep filtered frame numbers related to original
for f = 2:size(frames,3)-1
ff = sort( frames(:,:,f+[-1,0,1]), 3 );
nframes(:,:,f) = ff(:,:,2);
end