Dear Joseph,
if you've got a binary mask, the following code should give you the
coordinates in mm of the centroid of the non zero voxels:
v = spm_vol(spm_select(1,'image'));
vv = spm_read_vols(v);
[x y z] = ind2sub(v.dim,find(vv>0));
v.mat(1:3,:)*[mean([x,y,z],1)';1]
Best,
Guillaume.
Jokel Meyer wrote:
> Dear SPM-list!
>
> I created a mask using the pickatlas (this gives me a .img-file, a
> .mat-file and a .hdr-file)
> How can a find the coordinates of the centroid of the region defined by
> this mask?
> Any idea?
>
> Many thanks!
> Joseph
--
Guillaume Flandin, PhD
Wellcome Trust Centre for Neuroimaging
University College London
12 Queen Square
London WC1N 3BG
|