0001 function [V,F,xx,Vinfo,indx] = vb_get_cortex_surf_from_std(std_brain_file,snfile)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 [V,F,xx] = vb_load_cortex(std_brain_file);
0016
0017
0018 if nargin==2 && ~isempty(snfile)
0019 sn = load(deblank(snfile));
0020 V = vb_unsn( V'*1000, sn)'*0.001;
0021 end
0022
0023 NP = size(V,1);
0024 NL = F.NdipoleL;
0025
0026
0027 normal_mode = 0;
0028 [F1, V1, xx1, indx1] = vb_out_normal_surf(F.F3L,V(1:NL,:), normal_mode);
0029 [F2, V2, xx2, indx2] = vb_out_normal_surf(F.F3R - NL,V(NL+1:end,:), normal_mode);
0030
0031 omega1 = vb_solid_angle_check(V1,F1);
0032 omega2 = vb_solid_angle_check(V2,F2);
0033
0034 fprintf('omegaL/4pi = %e\n',omega1);
0035 fprintf('omegaR/4pi = %e\n',omega2);
0036
0037 V = [V1 ; V2];
0038 xx = [xx1; xx2];
0039 indx = [indx1; indx2 + NL];
0040 NL = size(V1,1);
0041
0042 Ndipole = size(V,1);
0043
0044 fprintf('Original Vertex = %d , New = %d\n',NP, Ndipole)
0045 fprintf('Original Left Vertex = %d , New = %d\n',F.NdipoleL, NL)
0046
0047
0048 F.F3L = F1;
0049 F.F3R = F2 + NL;
0050 F.F3 = [F.F3L ; F.F3R];
0051 F.NdipoleL = NL;
0052
0053
0054 Vinfo.NdipoleL = NL ;
0055 Vinfo.Ndipole = Ndipole;
0056 Vinfo.Npatch = size(F,1);
0057 Vinfo.Coord = 'SPM_Right_m';
0058
0059 return
0060
0061
0062
0063 load(std_brain_file,'vert','face','normal')
0064
0065 sn = load(deblank(snfile));
0066
0067
0068 V = vb_unsn( vert', sn)'*0.001;
0069
0070 [V,F,xx] = vb_separate_LR_cortex(V,face);