Home > vbmeg > 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(n,:) : average normal vector of n-th root point 
              over its neighborhood 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(n,:) : average normal vector of n-th root point
0009 %              over its neighborhood of original brain
0010 %
0011 % M. Sato  2006-7-23
0012 %
0013 % Copyright (C) 2011, ATR All Rights Reserved.
0014 % License : New BSD License(see VBMEG_LICENSE.txt)
0015 
0016 % Number of target vertex for calculation
0017 Nroot = length(member_id);        
0018 
0019 % average normal vector
0020 xxave = zeros(Nroot,3);
0021 
0022 for n=1:Nroot,
0023     % neighbor point index
0024     inext = member_id{n};
0025     
0026     % mean normal vector
0027     xxn = sum( xx(inext,:), 1);
0028     xxs = sum(xxn.^2);
0029     if xxs > 0
0030         xxave(n,:) = xxn/sqrt(xxs);
0031     end
0032 end;

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005