Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Out of memory when I am doing 3D FFT
Date: Fri, 9 Jan 2009 16:57:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 33
Message-ID: <gk7vku$naj$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1231520222 23891 172.30.248.38 (9 Jan 2009 16:57:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 9 Jan 2009 16:57:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1662939
Xref: news.mathworks.com comp.soft-sys.matlab:510660


Hi, there

I am working on CT image processing. I need to calculate the Hessian matrix of the volumetric dataset. It can be accomplished by convolution the image with the 2nd order partial derivatives of the Gaussian kernel.  Here is the way I am doing the convolution.


function FilterOut=perform_convolution_3d(Vol,vker)

%% Vol is the input volumetric image data whose size is 341 by 341 by 341, uint16, 
%% vker is an isotropic Gaussian vker whose size is 30 by 30 by 30

SizeV=size(Vol);

smoothcell=zeros(SizeV);
centerpix=floor(SizeV/2);
centerker=floor(size(vker)/2);

embed1i=centerpix(1)-centerker(1)+[1:size(vker,1)];
embed2i=centerpix(2)-centerker(2)+[1:size(vker,2)];
embed3i=centerpix(3)-centerker(3)+[1:size(vker,3)];

smoothcell(embed1i,embed2i,embed3i)=vker;

FFT1=fftn(double(Vol));
FFT2=fftn(double(smoothcell));
CPXARR2=FFT1.*conj(FFT2);
MFout=fftshift(ifftn(CPXARR2));

But the 'out of memory' problem always occurs when I implement the code.  I tried to save some of the un-used variables to the disk, only leaving the essential ones in the workspace, but the 'out of memory' problem still happens.

I use window xp 32 OP system with 2GB RAM.

Thanks for the help, 
David