Home > functions > brain > vb_calc_normal_average.m

vb_calc_normal_average

PURPOSE ^

average normal direction in the neighbor of root vertex

SYNOPSIS ^

function xxave = vb_calc_normal_average(member_id, xx)

DESCRIPTION ^

 average normal direction in the neighbor of root vertex
   xxave = vb_calc_normal_average(member_id, xx)
 --- Input
 member_id{n} : member vertex index which belog to the n-th root point 
 xx(i,:)      : normal vector at the vertex-i in the original brain
 --- Output
 xxave : average normal vector in the neighbor of original brain

 M. Sato  2006-7-23

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function    xxave = vb_calc_normal_average(member_id, xx)
0002 % average normal direction in the neighbor of root vertex
0003 %   xxave = vb_calc_normal_average(member_id, xx)
0004 % --- Input
0005 % member_id{n} : member vertex index which belog to the n-th root point
0006 % xx(i,:)      : normal vector at the vertex-i in the original brain
0007 % --- Output
0008 % xxave : average normal vector in the neighbor of original brain
0009 %
0010 % M. Sato  2006-7-23
0011 %
0012 % Copyright (C) 2011, ATR All Rights Reserved.
0013 % License : New BSD License(see VBMEG_LICENSE.txt)
0014 
0015 % Number of target vertex for calculation
0016 Nroot = length(member_id);        
0017 
0018 % average normal vector
0019 xxave = zeros(Nroot,3);
0020 
0021 for n=1:Nroot,
0022     % neighbor point index
0023     inext = member_id{n};
0024     
0025     % mean normal vector
0026     xxn = sum( xx(inext,:), 1);
0027     xxs = max( sqrt(sum(xxn.^2)), eps );
0028     xxave(n,:) = xxn/xxs;
0029 end;

Generated on Tue 27-Aug-2013 11:46:04 by m2html © 2005