Thats because some mail-tool things have a habit of wrapping lines when
they are too long. A new line means something in Matlab.
Instead of:
img = spm_slice_vol(V(i),spm_matrix([0 0
z]),V(i).dim(1:2),0); gl(i) = gl(i) + sum(img(:));
the offending line should have said:
img = spm_slice_vol(V(i),spm_matrix([0 0 z]),V(i).dim(1:2),0);
gl(i) = gl(i) + sum(img(:));
Here is the code as it should appear. To be sure, I have broken
the line in a different place and added "..." to indicate (to Matlab)
that the line should be continued.
Best regards,
-John
------------------------------------------------------------------
function gl = get_integrals(P)
% Integrate the values in an image.
if nargin<1,
P = spm_get(Inf,'*.img');
end;
V = spm_vol(P);
gl = zeros(length(V),1);
for i=1:length(gl),
for z=1:V(i).dim(3),
img = spm_slice_vol(V(i),...
spm_matrix([0 0 z]),V(i).dim(1:2),0);
gl(i) = gl(i) + sum(img(:));
fprintf('.');
end;
gl(i) = gl(i)*(det(V(i).mat)/100^3);
fprintf('\n');
end;
------------------------------------------------------------------
--
Dr John Ashburner.
Functional Imaging Lab., 12 Queen Square, London WC1N 3BG, UK.
tel: +44 (0)20 78337491 or +44 (0)20 78373611 x4381
fax: +44 (0)20 78131420 http://www.fil.ion.ucl.ac.uk/~john
|