Make new cortex model with reduced resolution [Jreduce,Vnew,Fnew] = vb_reduce_cortex(brainfile,Jindx,Reduce_ratio); --- Input brainfile Jindx : vertex index for traget region Reduce_ratio = 1/Nrate : reduced ratio number of reduced vertex points become 1/Nrate --- Output Jreduce : reduced vertex index in the original brain Vnew : vertex coordinate Fnew : patch index structure --- History Ver 1.1 by M. Sato 2003-4-15 2003-07-11 Modified by Taku Yoshioka 2004-3-28 Modified by M. Sato 2006-7-21 Modified by M. Sato 2008-11-28 Taku Yoshioka Use vb_disp() for displaying message 2021-0-25 rhayashi make IndxL,R value unique. Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [Jreduce,Vnew,Fnew,xx,Vinfo] = ... 0002 vb_reduce_cortex(brainfile,Jindx,Reduce_ratio); 0003 % Make new cortex model with reduced resolution 0004 % [Jreduce,Vnew,Fnew] = vb_reduce_cortex(brainfile,Jindx,Reduce_ratio); 0005 % 0006 % --- Input 0007 % brainfile 0008 % Jindx : vertex index for traget region 0009 % Reduce_ratio = 1/Nrate : reduced ratio 0010 % number of reduced vertex points become 1/Nrate 0011 % 0012 % --- Output 0013 % Jreduce : reduced vertex index in the original brain 0014 % Vnew : vertex coordinate 0015 % Fnew : patch index structure 0016 % 0017 % --- History 0018 % Ver 1.1 by M. Sato 2003-4-15 0019 % 2003-07-11 Modified by Taku Yoshioka 0020 % 2004-3-28 Modified by M. Sato 0021 % 2006-7-21 Modified by M. Sato 0022 % 2008-11-28 Taku Yoshioka 0023 % Use vb_disp() for displaying message 0024 % 2021-0-25 rhayashi 0025 % make IndxL,R value unique. 0026 % 0027 % Copyright (C) 2011, ATR All Rights Reserved. 0028 % License : New BSD License(see VBMEG_LICENSE.txt) 0029 0030 const = vb_define_verbose; 0031 VERBOSE_LEVEL_NOTICE = const.VERBOSE_LEVEL_NOTICE; 0032 0033 % 解像度を下げて皮質点を作成 0034 0035 % 全脳モデル 0036 [V,F,xx] = vb_load_cortex(brainfile); 0037 0038 % 頂点座標 V を左右の脳に分ける 0039 Ndipole = size(V,1); 0040 NdipoleL = F.NdipoleL ; 0041 0042 if ~exist('Jindx','var') | isempty(Jindx), Jindx = 1:Ndipole; end; 0043 if ~exist('Reduce_ratio','var'), Reduce_ratio = 1/3; end; 0044 0045 V0L = V(1:NdipoleL , :); 0046 V0R = V((NdipoleL+1):Ndipole , :); 0047 F0R = F.F3R ; 0048 F0L = F.F3L ; 0049 0050 % 0051 % --- Redeuce patch 0052 % 0053 vb_disp('--- Reduce cortex',VERBOSE_LEVEL_NOTICE); 0054 F0R = F0R - NdipoleL; 0055 [F3L,V3L] = vb_reducepatch(F0L,V0L,Reduce_ratio); 0056 [F3R,V3R] = vb_reducepatch(F0R,V0R,Reduce_ratio); 0057 0058 % 低解像度皮質点全点のもとの全脳モデルにおけるインデックス 0059 % --- Find original vertex point to reduced model 0060 % 0061 IndxL = unique( vb_find_match_point(V0L,V3L,50 ) ); 0062 IndxR = unique( vb_find_match_point(V0R,V3R,50 ) + NdipoleL ); 0063 0064 Jflag = zeros(Ndipole,1); % Extract point flag 0065 Jflag(Jindx) = 1; 0066 0067 ixL = find( Jflag(IndxL) > 0 ); 0068 ixR = find( Jflag(IndxR) > 0 ); 0069 0070 % Index of reduced brain in the original brain 0071 Jreduce = [ IndxL(ixL) ; IndxR(ixR) ]; 0072 0073 [V3L,F3L] = vb_trans_index( V3L, F3L, ixL); 0074 [V3R,F3R] = vb_trans_index( V3R, F3R, ixR); 0075 0076 NL = size(V3L,1); 0077 F3R = F3R + NL; 0078 0079 Vnew = [V3L; V3R]; 0080 0081 Fnew.F3L = F3L; 0082 Fnew.F3R = F3R; 0083 Fnew.F3 = [F3L; F3R ]; 0084 0085 Fnew.NdipoleL = NL ; 0086 0087 xx = xx(Jreduce,:); 0088 0089 % Dimensional info 0090 Vinfo.Ndipole = size(Vnew, 1); 0091 Vinfo.NdipoleL = NL; 0092 Vinfo.Npatch = size(Fnew.F3, 1); 0093 Vinfo.Coord = 'SPM_Right_m';