Effacer les filtres
Effacer les filtres

how can i solve this problem about 'OUT OF MEMORY'

3 vues (au cours des 30 derniers jours)
Beyung Doo Jo
Beyung Doo Jo le 9 Août 2011
when i use matrix, i always got out of memory.... actually i put zeros fuction to avoid it..
but, it is not work at all.
i'm using window 7 32bit 2G RAM Matlab 7.11.0 R2010b
Matrix size is 256 by 192
it's not big CT Image
Even if it takes a long tome, i think that it has to be worked.
Someone told me that the latest version of matlab has problem on it..
how can i get out of this problem. plz help me..
i'm not good at Matlab.
nx = length(x);
ny = length(y);
nz = length(z);
% Remark: There may be some savings in fft computation if P is transposed
[nv,nu] = size(P);
u = (-u_off + [0:nu-1]')*du;
v = (-v_off + [0:nv-1]')*dv;
% Remark: if P is transposed, 'meshgrid' should be changed to 'ndgrid'
[uu,vv] = meshgrid(u,v);
weight = SDD./sqrt(SDD^2 + vv.^2 + uu.^2);
% Remark: P is over-written to conserve memory in following computations.
% The interpretation at each stage should be clear from context
P = P .* weight;
% Filtering:
Phihat = varargin{1};
if ~isempty(Phihat), % Skip to backprojection is filter is empty
% Remark: This call to fft can likely be optimised using the transpose
% of P instead to capitalise on Matlab's column-oriented storage.
P = fft( P, length(Phihat), 2 ); % Rows zero-padded automatically
% Remark: This loop can likely be vectorised using repmat
for j=1:nv
P(j,:) = P(j,:) .* Phihat ;
end;
% Remark: This call to fft can likely be optimised using the transpose
% of P instead to capitalise on Matlab's column-oriented storage.
P = real( ifft( P, [], 2 ) );
P = P(:,1:nu); % Trim zero-padding on rows
end % of if-block
% Increment to add to reconstruction in backprojection stage
dR = zeros(ny,nx,nz);
% Vectorised computation of backprojection
[yy, xx, zz] = ndgrid( y, x, z);
% Use projection matrix to project reconstruction (x,y,z) grid
% into detector (u,v) grid
*UV = A * [ xx(:)'; yy(:)'; zz(:)'; ones(1,nx*ny*nz) ];*
* ---------->this part*
% Nearest neighbour interpolation to find detector coordinates (u,v)
% that are closest to projections of voxels (x,y,z)
U = round( UV(1,:)./UV(3,:) ) + 1 ;
V = round( UV(2,:)./UV(3,:) ) + 1 ;
% Identify indices of voxels with projections strictly within detector grid
ind = find( (U>=1) & (V>=1) & (U<=nu) & (V<=nv) );
% Remark: This will have to be changed if P is transposed
P_ind = ( U(ind) - 1 )*nv + V(ind) ;
  3 commentaires
Oleg Komarov
Oleg Komarov le 9 Août 2011
Also add the error message and which line it refers to.
Beyung Doo Jo
Beyung Doo Jo le 11 Août 2011
*UV = A * [ xx(:)'; yy(:)'; zz(:)'; ones(1,nx*ny*nz) ];*
* ---------->this part*
just they said that i got ' out of memory ', when i using above code.

Connectez-vous pour commenter.

Réponses (2)

Nirmal Gunaseelan
Nirmal Gunaseelan le 9 Août 2011
There is an excellent resource on understanding how MATLAB uses memory and how you can avoid out of memory issues - Avoiding Out of Memory issues - that might help you resolve such issues easily.
  1 commentaire
Beyung Doo Jo
Beyung Doo Jo le 11 Août 2011
thx, i've already seen this page :) It'll help me for avoding out of memory.

Connectez-vous pour commenter.


Sean de Wolski
Sean de Wolski le 9 Août 2011
Buy more RAM and upgrade to a 64bit system. CT scans, by nature, require a lot of memory. Also, you could convert to integers to save a little bit more.

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by