Hi Susana,
Thanks for solving this! I've copied this to the list in case it helps
anyone else who is trying to switch between SPM versions.
> There's two different signs, one in the first voxel dimension and one in
> the first element of the last column (is that the x coordinate of the
> origin?).
Right, the two sign-changes correspond to changing the direction of
the x-axis. This is probably to do with settings of the analyze-flip
field in the SPM5 defaults, compared to however SPM99 handles this...
(I'm afraid I'm not sure, but I think SPM99 always flips, presumably
your SPM5 saved .mat didn't). So if you use this script, be careful
that your left-right convention is/remains how you expect it to be
(this can get very confusing...).
> So the only problem with your script is that it saves the matrix with
> the name 'mat' and it should be 'M' to match the .mat file created by
> SPM99.
Ahh, okay. I think 'mat' is correct for SPM2, though, and I don't
think there should be any problem with including both names in the
saved file, so the following should work for going from SPM5 to 2 or 99:
files = spm_select(inf, 'image');
for f = 1:size(files, 1);
file = deblank(files(f, :));
V = spm_vol(file);
mat = V.mat; M = mat;
[pth fnm ext] = spm_fileparts(file);
matfile = fullfile(pth, [fnm '.mat']);
save(matfile, 'M', 'mat');
end
Best,
Ged
|