Transform coordinate of vertex points on an individual brain to those on the MNI starndard brain. MNI coordinate as well as Talairach coordinate corresponding to 'V' are returned. This routine requires FreeSurfer sphere files. [Usage] [XYZmni , XYZtal] = vb_calc_mni_coord_fs(parm); [Input] Fields in 'parm' struct brain_file : Subject Cortical model file(.brain.mat) FS_right_sphere_file : Subject FreeSurfer right sphere file(.sphere.reg.asc) FS_left_sphere_file : Subject FreeSurfer left sphere file(.sphere.reg.asc) FS_sphere_key : Registration key of sphere coordinate value to brain_file. [Output] XYZmni : MNI coordinate (unit:m) [Nveretex * 3] XYZtal : Talairach coordinate (unit:m) [Nveretex * 3] [History] 2013-01-25 rhayashi Copy and modified vb_calc_mni_coord.m Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [XYZmni, XYZtal] = vb_calc_mni_coord_fs(parm) 0002 % Transform coordinate of vertex points on an individual brain to those on the MNI starndard brain. 0003 % MNI coordinate as well as Talairach coordinate corresponding to 'V' are 0004 % returned. This routine requires FreeSurfer sphere files. 0005 % 0006 % [Usage] 0007 % [XYZmni , XYZtal] = vb_calc_mni_coord_fs(parm); 0008 % 0009 % [Input] 0010 % Fields in 'parm' struct 0011 % brain_file : Subject Cortical model file(.brain.mat) 0012 % FS_right_sphere_file : Subject FreeSurfer right sphere file(.sphere.reg.asc) 0013 % FS_left_sphere_file : Subject FreeSurfer left sphere file(.sphere.reg.asc) 0014 % FS_sphere_key : Registration key of sphere coordinate value to brain_file. 0015 % 0016 % [Output] 0017 % XYZmni : MNI coordinate (unit:m) [Nveretex * 3] 0018 % XYZtal : Talairach coordinate (unit:m) [Nveretex * 3] 0019 % 0020 % [History] 0021 % 2013-01-25 rhayashi Copy and modified vb_calc_mni_coord.m 0022 % 0023 % Copyright (C) 2011, ATR All Rights Reserved. 0024 % License : New BSD License(see VBMEG_LICENSE.txt) 0025 0026 % Cortical model file contains cortex and sphere coordinate 0027 % which is made from ICBM152c Template image. 0028 global vbmeg_inst; 0029 brain_file_template = vbmeg_inst.const.FILE_MNI_ICBM152_BRAIN; 0030 0031 % 0032 % --- Sphere coregistration between template and subject cortical file 0033 % 0034 [d, f, e] = vb_get_file_parts(parm.brain_file); 0035 proj_root = d; 0036 brain_parm.brain_file = [f, e]; 0037 brain_parm.brain_sphR = parm.FS_right_sphere_file; 0038 brain_parm.brain_sphL = parm.FS_left_sphere_file; 0039 brain_parm.key = parm.FS_sphere_key; 0040 vb_job_brain_add_sphcoord(proj_root, brain_parm); 0041 0042 % Map template-coordinate to subject cortex 0043 XYZmni = inner_calc_mni_coord(brain_file_template, parm); 0044 0045 % mni2tal : MNI to Talairach coordinate transformation 0046 XYZtal = mni2tal(XYZmni); 0047 0048 return; 0049 0050 function XYZmni = inner_calc_mni_coord(brain_file_template, parm) 0051 % [IN] 0052 % brain_file_template : template brain file. 0053 % parm : same as caller function's. 0054 % [OUT] 0055 % XYZmni : MNI coordinate 0056 0057 0058 % --- load coordinates of cortical models 0059 V1_sph = vb_load_cortex(brain_file_template, 'sphere.reg'); 0060 V2_sph = vb_load_cortex(parm.brain_file, parm.FS_sphere_key); 0061 T_mni = vb_load_cortex(brain_file_template, 'MNI'); 0062 0063 load(brain_file_template, 'Vinfo'); 0064 IL1 = Vinfo.NdipoleL; 0065 load(parm.brain_file, 'Vinfo'); 0066 IL2 = Vinfo.NdipoleL; 0067 0068 V1_sph(1:IL1,1) = V1_sph(1:IL1,1)-400; 0069 V2_sph(1:IL2,1) = V2_sph(1:IL2,1)-400; 0070 0071 % --- obtain nearest vertex for each of sbj_test vertices 0072 ix = []; 0073 I = size(V1_sph,1); 0074 0075 for i=1:size(V2_sph,1) 0076 d = sum((repmat(V2_sph(i,:),[I 1])-V1_sph).^2,2); 0077 [tmp,ixx] = min(d); 0078 ix = [ix; ixx]; 0079 end 0080 0081 XYZmni = T_mni(ix,:); 0082 0083 return;