Hello Mark,
> dI am trying to find the center of mass for evaluation of both the size of
> the voxel and also the volume of the voxel itself. Does anyone know of a
> way to do this using spm or must you use matlab to do so? if so what is the
> best way at going about this.
> thankyou for your help
> mark
I really wouldn't know if SPM supports this. When automated the normalisation of PET images, I also had to set the origin in the .mat-files as the normalisation routines are very sensitive to translations in the starting transformation.
Attached is a try-out program I used to compute the centre of mass in a volume. It is very general, but I think it can be embedded very easily if you are willing to write your own matlab functions.
Hope this helps,
Alle Meije Wink
--
Alle Meije Wink
Institute for Mathematics and Computing Science, room 105
University of Groningen P.O. Box 800
9700 AV Groningen
Telephone +31 50 363 71 27 The Netherlands
Fax: +31 20 875 48 00
E-mail: [log in to unmask]
WWW: http://www.cs.rug.nl/~wink
" I guess it comes down to a simple choice, really.
Get busy living, or get busy dying. "
(Andy Dufresne in The Shawshank Redemption)
function f = cofmass3d(mat3D)
%computes the centre of mass in a 3D volume
%determine the size of the matrix
dimensions=size(mat3D);
rows=dimensions(1,1);
cols=dimensions(1,2);
plan=dimensions(1,3);
npoints=sum(sum(sum(mat3D)));
%calculate the centre of mass for the x co-ordinates
x = 1:rows;
y = 1:cols;
z = 1:plan;
rowtotal=sum(x*mat3D(:,y,z));
coltotal=sum(mat3D(x,:,z)*y');
platotal=sum(mat3D(x,y,:)*z');
f=[rowtotal/npoints coltotal/npoints platotal/npoints];
|