Import FreeSurfer annotation file. [syntax] vb_import_fsannot_file(brain_file,area_file,antl_file,antr_file) [input] brain_file: <<string>> Cortical surface model file (.brain.mat). area_file : <<string>> Cortical area file (.area.mat) antl_file : <<string>> FS annotation file for lh. antr_file : <<string>> FS annotation file for rh. [output] Cortical areas are stored into the cortical area file. These areas are associated with labels defined with FS. [example] >> brain_file = '3D.brain.mat'; >> area_file = 'fs_annotation.area.mat'; >> antl_file = 'lh.aparc.a2009s.annot'; >> antr_file = 'rh.aparc.a2009s.annot'; >> vb_import_fsannot_file(brain_file,area_file,antl_file,antr_file) [history] 2011-06-17 taku-y 2012-02-20 taku-y [debug] Due to using information in fsannot file without modification, color value could be out of range from 0.0 to 1.0. taken directly from fsannot file. This bug has been fixed.
0001 function vb_import_fsannot_file(brain_file,area_file,antl_file,antr_file) 0002 % Import FreeSurfer annotation file. 0003 % 0004 % [syntax] 0005 % vb_import_fsannot_file(brain_file,area_file,antl_file,antr_file) 0006 % 0007 % [input] 0008 % brain_file: <<string>> Cortical surface model file (.brain.mat). 0009 % area_file : <<string>> Cortical area file (.area.mat) 0010 % antl_file : <<string>> FS annotation file for lh. 0011 % antr_file : <<string>> FS annotation file for rh. 0012 % 0013 % [output] 0014 % Cortical areas are stored into the cortical area file. These areas are 0015 % associated with labels defined with FS. 0016 % 0017 % [example] 0018 % >> brain_file = '3D.brain.mat'; 0019 % >> area_file = 'fs_annotation.area.mat'; 0020 % >> antl_file = 'lh.aparc.a2009s.annot'; 0021 % >> antr_file = 'rh.aparc.a2009s.annot'; 0022 % >> vb_import_fsannot_file(brain_file,area_file,antl_file,antr_file) 0023 % 0024 % [history] 0025 % 2011-06-17 taku-y 0026 % 2012-02-20 taku-y 0027 % [debug] Due to using information in fsannot file without modification, 0028 % color value could be out of range from 0.0 to 1.0. taken 0029 % directly from fsannot file. This bug has been fixed. 0030 0031 0032 % load .brain.mat 0033 load(brain_file,'BV_index'); 0034 0035 % load annotation file for lh 0036 [v,l,c] = read_annotation(antl_file); 0037 0038 % make label data that of VBMEG brain model for lh 0039 [tmp,ix1,ix2] = intersect(BV_index.Left,v+1); 0040 l = l(ix2); 0041 l(ix1) = l; 0042 Ileft0 = length(v); 0043 Ileft = length(BV_index.Left); 0044 0045 % make area for lh 0046 for i=1:c.numEntries 0047 Area.key = ['lh_' c.struct_names{i}]; 0048 Area.Iextract = find(l==c.table(i,5)); 0049 Area.clr = c.table(i,1:3); 0050 0051 % here it is assumed that the maximal color value is 255. 0052 % 2012-02-20 taku-y 0053 Area.clr = (Area.clr)./255; 0054 0055 vb_add_area(area_file,Area); 0056 end 0057 0058 % load annotation file for rh 0059 [v,l,c] = read_annotation(antr_file); 0060 0061 % make label data that of VBMEG brain model for lh 0062 [tmp,ix1,ix2] = intersect(BV_index.Right,v+Ileft0+1); 0063 l = l(ix2); 0064 l(ix1) = l; 0065 0066 % make area for rh 0067 for i=1:c.numEntries 0068 Area.key = ['rh_' c.struct_names{i}]; 0069 Area.Iextract = find(l==c.table(i,5))+Ileft; 0070 Area.clr = c.table(i,1:3); 0071 0072 % here it is assumed that the maximal color value is 255. 0073 % 2012-02-20 taku-y 0074 Area.clr = (Area.clr)./255; 0075 0076 vb_add_area(area_file,Area); 0077 end 0078 0079 return;