Hi Shary, all,
[log in to unmask] wrote:
> In SPM5, is spmT*.img the image which shows jacobian determinants? I
> need to see the image whose voxel value refers to the amount of
> contraction/expansion during nomalization into MNI space.
spmT contains the t-values from a previous statistical test. I don't
think the Jacobian images are written by default. I also don't know of
a simple way to get them -- hopefully someone will correct me here if
I'm missing something.
I think you can get them, albeit not very elegantly, by warping and
modulating a constant unity image, the attached should do the job.
> if a voxel's value is 1.2, this should mean that there has been 20%
> expansion. Or, if a voxel's value is 0.75, this should mean that there
> has been 25% contraction at those coordinates.
That's right, although you need to be careful of the direction of
transformation that the Jacobians are for. I think 1.2 means 20%
expansion of that *template* voxel would be required to match the
volume of the corresponding voxel in the original image. Again, I hope
someone shouts at me if that's wrong!
Best,
Ged.
P.S. Another answer to this question would be: use John's high
dimensional warping toolbox, which I think should give more sensible
warps/Jacobians, and I believe automatically outputs the deformation
field and its Jacobian image.
function write_jac(fnms)
% write_jac -- write Jacobian determinant images
% from _seg_sn.mat files corresponding to chosen images
if ~exist('fnms', 'var');
fnms = spm_select(inf, 'image', 'Choose original images');
end
for f = 1:size(fnms, 1)
fnm = deblank(fnms(f, :));
v = spm_vol(fnm); vj = v;
[pth fnm ext] = spm_fileparts(v.fname);
vj.fname = fullfile(pth, [fnm '_jac' ext]);
mfname = fullfile(pth, [fnm '_seg_sn.mat']);
vj.pinfo = [1 0 0]';
% all ones means scaling gets confused, so temporarily switch warning
% about division by zero off...
old = warning('query', 'MATLAB:DivideByZero');
warning('off', 'MATLAB:DivideByZero');
spm_write_vol(vj, ones(vj.dim));
warning(old.state, 'MATLAB:DivideByZero');
flags = struct('interp',1,'vox',nan(1,3),'bb',nan(2,3),'preserve',1);
mwvj = spm_write_sn(vj.fname, mfname, flags);
spm_unlink(vj.fname);
% warping brings zero or nan in at edges, change these to ones:
tmp = spm_read_vols(mwvj);
spm_unlink(mwvj.fname);
mwvj.fname = vj.fname;
tmp(tmp == 0 | isnan(tmp)) = 1;
spm_write_vol(mwvj, tmp);
end
|