--- function [V,C,Indx] = vb_fs_load_surface(patchfile,curvfile) Load patch file and original indices. --- Input FS_index: FS indices in reduced cortical model (1-start) --- Output V : Vertex coordinates F : Faces C : Curvature Indx : Vertex index in the FS original model (1-start) 2006-02-01 Taku Yoshioka --- Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [V,F,C,Indx] = vb_fs_load_patch(patchfile,curvfile) 0002 % --- 0003 % function [V,C,Indx] = vb_fs_load_surface(patchfile,curvfile) 0004 % 0005 % Load patch file and original indices. 0006 % 0007 % --- Input 0008 % FS_index: FS indices in reduced cortical model (1-start) 0009 % 0010 % --- Output 0011 % V : Vertex coordinates 0012 % F : Faces 0013 % C : Curvature 0014 % Indx : Vertex index in the FS original model (1-start) 0015 % 0016 % 2006-02-01 Taku Yoshioka 0017 % --- 0018 % 0019 % Copyright (C) 2011, ATR All Rights Reserved. 0020 % License : New BSD License(see VBMEG_LICENSE.txt) 0021 0022 % Load patch data 0023 fid = fopen(patchfile,'r'); 0024 fgetl(fid); % Comment line 0025 tmp = fscanf(fid,'%d %d',2); 0026 NV = tmp(1); % Number of vertices 0027 NF = tmp(2); % Number of patches 0028 0029 % Load vertices 0030 V = []; 0031 Indx = []; 0032 for i=1:NV 0033 ix = fscanf(fid,'%d',1)+1; % Original vertex index 0034 Indx = [Indx; ix]; 0035 tmp = fscanf(fid,'%e %e %e',3); 0036 V = [V; tmp']; 0037 end 0038 0039 % Load faces 0040 F = []; 0041 for i=1:NF 0042 fscanf(fid,'%d',1); 0043 tmp = fscanf(fid,'%e %e %e',3)+1; 0044 ix1 = find(tmp(1)==Indx); 0045 ix2 = find(tmp(2)==Indx); 0046 ix3 = find(tmp(3)==Indx); 0047 F = [F; ix1 ix2 ix3]; 0048 end 0049 0050 fclose(fid); 0051 0052 % Load curvature data 0053 n = load('-ascii',curvfile); % inner function 0054 C = n(Indx,5); 0055 C = (C./max(abs(C))+1)*0.5;