Load cortical vertex coordinate & normal vector specified by area_key [V, xx] = vb_load_cortex_area(brainfile,areafile,area_key,mode,coord_type) -- Input brainfile : Brain file name --- Optional input areafile : Area file name area_key : area key mode = 0 : normal vector at the vertex = 1 : average normal vector in the neighbor of BV original brain coord_type : = 'subj' : subject brain normal. = 'std' : standard brain normal(valid in BRAIN-MAT V2 format). --- Output V : cortex vertex coordinate [Nvertex, 3] xx : Normal vector to cortical surface [Nvertex, 3] Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [V, xx] = vb_load_cortex_area(brainfile,areafile,area_key, mode, coord_type) 0002 % Load cortical vertex coordinate & normal vector specified by area_key 0003 % [V, xx] = vb_load_cortex_area(brainfile,areafile,area_key,mode,coord_type) 0004 % -- Input 0005 % brainfile : Brain file name 0006 % --- Optional input 0007 % areafile : Area file name 0008 % area_key : area key 0009 % mode = 0 : normal vector at the vertex 0010 % = 1 : average normal vector in the neighbor of BV original brain 0011 % coord_type : = 'subj' : subject brain normal. 0012 % = 'std' : standard brain normal(valid in BRAIN-MAT V2 format). 0013 % --- Output 0014 % V : cortex vertex coordinate [Nvertex, 3] 0015 % xx : Normal vector to cortical surface [Nvertex, 3] 0016 % 0017 % Copyright (C) 2011, ATR All Rights Reserved. 0018 % License : New BSD License(see VBMEG_LICENSE.txt) 0019 0020 if ~exist('mode','var'), mode = 0; end; 0021 0022 if ~exist('coord_type', 'var') 0023 coord_type = 'subj'; 0024 end 0025 0026 if strcmp(coord_type, 'subj') 0027 [V, tmp, xx] = vb_load_cortex(brainfile, 'subj'); 0028 else 0029 [V, tmp, xx] = vb_load_cortex(brainfile); 0030 end 0031 0032 if mode == 1 0033 xx = vb_cortex_normal_average(brainfile,areafile,area_key,coord_type); 0034 return; 0035 end 0036 0037 if ~exist('areafile','var') || ~exist('area_key','var'), 0038 return; 0039 end 0040 0041 % 0042 % select area 0043 % 0044 if ~isempty(areafile) && ~isempty(area_key) 0045 Area = vb_get_area([areafile], area_key); 0046 ix = Area.Iextract; 0047 V = V(ix,:); 0048 xx = xx(ix,:); 0049 end 0050