Home > functions > brain > vb_cortex_normal_variance.m

vb_cortex_normal_variance

PURPOSE ^

average normal direction in the neighbor of vertex

SYNOPSIS ^

function [xxdev ,angl ]=vb_cortex_normal_variance(brainfile,areafile,areakey,para)

DESCRIPTION ^

 average normal direction in the neighbor of vertex
  [xxdev] = vb_cortex_normal_variance(brainfile,areafile,areakey,para)
 --- Input
 brainfile
 areafile
 areakey
 
 --- Optional input
 para.tan_var : tangential variance coefficient
 para.var_max : tangential variance max

 In the brainfile, 'normal_stat' should be exist:
   normal_stat.neighbor_org : original brain neighbor index list
   normal_stat.normal_org   : original brain normal vector
 --- Output
 xxdev      : deviation from average normal vector  (NP x 3)
 xxdev(:,1) = variance ratio for average normal vector direction
 xxdev(:,2) = variance ratio for tangential direction
 xxdev(:,3) = variance ratio for tangential direction

 angl = Angle between neighboring normal vector and average normal vector

 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   [xxdev ,angl ]= ...
0002              vb_cortex_normal_variance(brainfile,areafile,areakey,para)
0003 % average normal direction in the neighbor of vertex
0004 %  [xxdev] = vb_cortex_normal_variance(brainfile,areafile,areakey,para)
0005 % --- Input
0006 % brainfile
0007 % areafile
0008 % areakey
0009 %
0010 % --- Optional input
0011 % para.tan_var : tangential variance coefficient
0012 % para.var_max : tangential variance max
0013 %
0014 % In the brainfile, 'normal_stat' should be exist:
0015 %   normal_stat.neighbor_org : original brain neighbor index list
0016 %   normal_stat.normal_org   : original brain normal vector
0017 % --- Output
0018 % xxdev      : deviation from average normal vector  (NP x 3)
0019 % xxdev(:,1) = variance ratio for average normal vector direction
0020 % xxdev(:,2) = variance ratio for tangential direction
0021 % xxdev(:,3) = variance ratio for tangential direction
0022 %
0023 % angl = Angle between neighboring normal vector and average normal vector
0024 %
0025 % M. Sato  2006-7-23
0026 %
0027 % Copyright (C) 2011, ATR All Rights Reserved.
0028 % License : New BSD License(see VBMEG_LICENSE.txt)
0029 
0030 % tangential variance coefficient
0031 if exist('para','var') & isfield(para,'tan_var')
0032     tan_var = para.tan_var;
0033 else
0034     tan_var = 1;
0035 end
0036 
0037 % tangential variance max
0038 if exist('para','var') & isfield(para,'var_max')
0039     var_max = para.var_max;
0040 else
0041     var_max = 2/3;
0042 end
0043 
0044 % tangential angle max
0045 angle_max = pi/2;
0046 
0047 normal_stat = vb_load_normal_statics(brainfile);
0048 
0049 %
0050 % --- original vertex near the cortical vertex
0051 %
0052 % normal_stat.neighbor_org : original brain neighbor index list
0053 % normal_stat.normal_org   : original brain normal vector
0054 
0055 %
0056 % --- Angle between neighboring normal vector and average normal vector
0057 %
0058 fprintf('--- Normal vector variance\n')
0059 angl = vb_calc_normal_variance(normal_stat.neighbor_org,normal_stat.normal_org );
0060 
0061 %
0062 % select area
0063 %
0064 if exist('areafile','var') & exist('area_key','var') ...
0065       & ~isempty(areafile) & ~isempty(area_key),
0066     Area = vb_get_area([areafile], area_key);
0067     ix   = Area.Iextract;
0068     angl = angl(ix);
0069 end
0070 
0071 NP    = length(angl);
0072 xxdev = zeros(NP,3);
0073 tvar  = sin( min( tan_var * abs(angl), angle_max) );
0074 tvar  = min( tvar, var_max );
0075 
0076 xxdev(:,1) = 1;
0077 xxdev(:,2) = tvar;
0078 xxdev(:,3) = tvar;
0079 
0080 xxn   = sum(xxdev,2);
0081 xxdev = xxdev./repmat(xxn, [1 3]);

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