Dear Joao,
if you have [x,y,z] coordinates of a voxel in mm (e.g. location of a
peak in a normalised SPM{.}), you can do the following to get its label
from an atlas image (provided that this atlas is in the same space):
XYZmm = [52 -68 6];
v = spm_vol('atlas.nii')
XYZ = v.mat\[XYZmm 1]';
spm_sample_vol(v,XYZ(1),XYZ(2),XYZ(3),0)
You can then lookup that label value in a table to get the corresponding
name of the region, according to the atlas.
There are a number of SPM toolboxes that will do that for you for common
atlases, see:
http://www.fil.ion.ucl.ac.uk/spm/ext/
Best regards,
Guillaume.
Joćo Duarte wrote:
> Dear Guillaume,
>
> thanks a lot! It was very clear. Still I have one question. If I want to
> locate a certain voxel in a brain atlas, how should I do? The XYZ
> contains the coordinates in mm of the voxels, starting where (where is
> the origin) ?
>
> Thanks in advance,
>
> Joćo
>
> On Thu, Nov 19, 2009 at 6:04 PM, Guillaume Flandin
> <[log in to unmask] <mailto:[log in to unmask]>> wrote:
>
> Dear Joao,
>
> the output XYZ from spm_read_vols contains the coordinates in mm of the
> voxels constituting your image volume. The storage is column-based:
> http://www.mathworks.com/access/helpdesk/help/techdoc/math/f1-85462.html#f1-85511
> http://www.mathworks.com/access/helpdesk/help/techdoc/math/f1-86528.html#f1-86846
> ie:
> v = spm_vol(fullfile(spm('Dir'),'canonical','single_subj_T1.nii'))
> [Y,XYZ]=spm_read_vols(v);
> size(Y) % same than v.dim
> size(XYZ) % is [3 x numel(Y)]
> Y(20,30,40) % intensity at voxel [20 30 40]
> i = sub2ind(v.dim,20,30,40) % linear index
> Y(i) % same than Y(20,30,40)
> XYZ(:,i) % coordinates of voxel [20 30 40] in mm
> v.mat(1:3,:)*[20 30 40 1]' % indeed
>
> I hope this helps,
> Guillaume.
>
>
> Joćo Duarte wrote:
> >
> > Dear SPMers
> >
> > I am using the function spm_read_vols to open anatomical images in
> > MatLab. The functions works fine but I don't know how do the
> coordinates
> > given in the matrix XYZ correspond with the intensities given in the
> > variable Y. Can you help, please?
> >
> > Thanks
> >
> > Joao
--
Guillaume Flandin, PhD
Wellcome Trust Centre for Neuroimaging
University College London
12 Queen Square
London WC1N 3BG
|