Home > vbmeg > functions > brain > vb_neighbor_cos.m

vb_neighbor_cos

PURPOSE ^

Calculate direction COS between cortex normal vector and

SYNOPSIS ^

function [JDall, JDpoint] = vb_neighbor_cos(xxF,xx,Iextract)

DESCRIPTION ^

 Calculate direction COS between cortex normal vector and
                                 that of neighbor points
 xx(i,:)      : 部分脳モデル頂点 i の法線方向
 Iextract(i)  : 部分脳モデル頂点 i の 全脳モデル頂点番号
 xxF{n}       : 全脳モデル頂点 n の 隣接近傍頂点番号

 JDall(i)       : Direction COS between point-i and its neighbor point
 JDpoint(i,1) : Current  point inex
 JDpoint(i,2) : Neighbor inex

 Ver 1.0 written by M. Sato  2003-3-15

 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    [JDall, JDpoint] = vb_neighbor_cos(xxF,xx,Iextract)
0002 % Calculate direction COS between cortex normal vector and
0003 %                                 that of neighbor points
0004 % xx(i,:)      : 部分脳モデル頂点 i の法線方向
0005 % Iextract(i)  : 部分脳モデル頂点 i の 全脳モデル頂点番号
0006 % xxF{n}       : 全脳モデル頂点 n の 隣接近傍頂点番号
0007 %
0008 % JDall(i)       : Direction COS between point-i and its neighbor point
0009 % JDpoint(i,1) : Current  point inex
0010 % JDpoint(i,2) : Neighbor inex
0011 %
0012 % Ver 1.0 written by M. Sato  2003-3-15
0013 %
0014 % Copyright (C) 2011, ATR All Rights Reserved.
0015 % License : New BSD License(see VBMEG_LICENSE.txt)
0016 
0017 NV        = size(xxF,1);                    % Number of vertex
0018 
0019 if nargin < 3, Iextract = 1:NV; end;
0020 
0021 % 旧頂点番号から新しい頂点番号へ変換する変換表
0022 % Itrans(i)=0 : 旧頂点番号 = i は新しい頂点に含まれない
0023 % Itrans(i)=j : 旧頂点番号 = i は新しい頂点 = j に対応
0024 N                 = length(Iextract);
0025 Itrans             = zeros(NV,1);
0026 Itrans(Iextract) = 1:N;
0027 
0028 JDpoint = [];
0029 
0030 for i=1:N,
0031     n        = Iextract(i);
0032     indx    = Itrans(xxF{n});                % Neighbor index
0033     inext    = indx(indx>0);
0034     NL        = length(inext);
0035     
0036     if NL==0, continue; end;
0037     
0038     JDpoint = [ JDpoint; i*ones(NL,1) ,inext(:) ];
0039 end;
0040 
0041 J0        = xx(JDpoint(:,2),:);    % Current direction at n
0042 JJ        = xx(JDpoint(:,1),:);    % Current direction at neighbor
0043 JDall    = sum( JJ.*J0 , 2 );    % Direction COS

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