fft of large 3d volume

1 view (last 30 days)
Chris Walker
Chris Walker on 3 Sep 2012
I am using the new partial read of a matfile to do a 3d fft of a large volume, as it is too large to fit into memory. I am testing on a smaller volume to start with. First I fft the volume (matObj.X) slice by slice, then I do an fft in the remaining dimension in a second pass and put the output into a temporary matfile. The first pass takes about 2 seconds and the second pass takes about twenty minutes. I assume the second pass takes so much longer because the data in the final dimension is not in a sequence on disc. Is there any way to speed up the second pass? Code is below, I hope it is understandable! Thanks in advance. Chris W.
tic
wbh = waitbar(0,'fft first pass');
for i = 1:sz(3)
slice = double(matObj.X(:,:,i));
fftOut1 = fft2(slice);
localMatObj.x3real(:,:,i) = real(fftOut1);
localMatObj.x3imag(:,:,i) = imag(fftOut1);
waitbar(i/(sz(3)), wbh);
end
close(wbh);
toc
tic
wbh = waitbar(0,'fft second pass');
for i = 1:sz(1)
for j = 1:sz(2)
fftOut2 = fft(complex(localMatObj.x3real(i,j,:),localMatObj.x3imag(i,j,:)));
localMatObj.x3real(i,j,:) = real(fftOut2);
localMatObj.x3imag(i,j,:) = imag(fftOut2);
end
waitbar(i/(sz(1)), wbh);
end
close(wbh);
toc

Answers (0)

Categories

Find more on Fourier Analysis and Filtering in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!