Home > marsbar > @maroi_shape > c_o_m.m

c_o_m

PURPOSE ^

c_o_m method - calculates centre of mass

SYNOPSIS ^

function pt = c_o_m(o, sp, pt_type)

DESCRIPTION ^

 c_o_m method - calculates centre of mass

 $Id$

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function pt = c_o_m(o, sp, pt_type)
0002 % c_o_m method - calculates centre of mass
0003 %
0004 % $Id$
0005   
0006 if nargin < 2
0007   sp = '';
0008 end
0009 if nargin < 3
0010   pt_type = 'real';
0011 end
0012 pt = centre(o);
0013 switch pt_type
0014  case {'real','mm'}
0015  case 'vox'
0016   if isempty(sp)
0017     error('Need space to define voxel centre of mass');
0018   end
0019   pt = sp.mat * [pt; 1];
0020   pt = pt(1:3)';
0021  otherwise
0022   error(['Do not recognize point type' pt_type]);
0023 end

Generated on Wed 11-May-2022 16:26:09 by m2html © 2003-2019