Dear All:
John's gems #6 on a pre-processed image does in fact return SPM coords:
http://www.sph.umich.edu/~nichols/JohnsGems.html#Gem6
His code:
* * * * * * * * * * * * * * * * * * * * * * * * * * * * --
V=spm_vol(spm_get(Inf,'*.img'));
x = 32;
y = 32;
z = 32;
dat = zeros(length(V),1);
for i=1:length(dat),
dat(i) = spm_sample_vol(V(i),x,y,z,0);
end;
* * * * * * * * * * * * * * * * * * * * * * * * * * * * --
If you would like to use coordinates in mm do:
coord_mm = [x_mm y_mm z_mm 1];
coord_mni = coord_mm * inv(V(i).mat)';
x = coord_mni(1);
y = coord_mni(2);
z = coord_mni(3);
Another alternative once you have a V structure is to do
m = spm_read_vols(V(i));
Then you can do dat(i) = m(x,y,z);
I am guessing the way with spm_sample_vol is faster with a few coordinates
Thank you
Sincerely yours
Misha Koshelev
--
Misha Koshelev
MD/PhD Student
Human Neuroimaging Laboratory
One Baylor Plaza
S104
Baylor College of Medicine
Houston, TX 77030
|