0001 function [Jreduce,Vnew,Fnew,xx,Vinfo] = ...
0002 vb_reduce_cortex(brainfile,Jindx,Reduce_ratio);
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028 const = vb_define_verbose;
0029 VERBOSE_LEVEL_NOTICE = const.VERBOSE_LEVEL_NOTICE;
0030
0031
0032
0033
0034 [V,F,xx] = vb_load_cortex(brainfile);
0035
0036
0037 Ndipole = size(V,1);
0038 NdipoleL = F.NdipoleL ;
0039
0040 if ~exist('Jindx','var') | isempty(Jindx), Jindx = 1:Ndipole; end;
0041 if ~exist('Reduce_ratio','var'), Reduce_ratio = 1/3; end;
0042
0043 V0L = V(1:NdipoleL , :);
0044 V0R = V((NdipoleL+1):Ndipole , :);
0045 F0R = F.F3R ;
0046 F0L = F.F3L ;
0047
0048
0049
0050
0051 vb_disp('--- Reduce cortex',VERBOSE_LEVEL_NOTICE);
0052 F0R = F0R - NdipoleL;
0053 [F3L,V3L] = reducepatch(F0L,V0L,Reduce_ratio);
0054 [F3R,V3R] = reducepatch(F0R,V0R,Reduce_ratio);
0055
0056
0057
0058
0059 IndxL = vb_find_match_point(V0L,V3L,50 );
0060 IndxR = vb_find_match_point(V0R,V3R,50 ) + NdipoleL;
0061
0062 Jflag = zeros(Ndipole,1);
0063 Jflag(Jindx) = 1;
0064
0065 ixL = find( Jflag(IndxL) > 0 );
0066 ixR = find( Jflag(IndxR) > 0 );
0067
0068
0069 Jreduce = [ IndxL(ixL) ; IndxR(ixR) ];
0070
0071 [V3L,F3L] = vb_trans_index( V3L, F3L, ixL);
0072 [V3R,F3R] = vb_trans_index( V3R, F3R, ixR);
0073
0074 NL = size(V3L,1);
0075 F3R = F3R + NL;
0076
0077 Vnew = [V3L; V3R];
0078
0079 Fnew.F3L = F3L;
0080 Fnew.F3R = F3R;
0081 Fnew.F3 = [F3L; F3R ];
0082
0083 Fnew.NdipoleL = NL ;
0084
0085 xx = xx(Jreduce,:);
0086
0087
0088 Vinfo.Ndipole = size(Vnew, 1);
0089 Vinfo.NdipoleL = NL;
0090 Vinfo.Npatch = size(Fnew.F3, 1);
0091 Vinfo.Coord = 'SPM_Right_m';