PROJECT VOXEL TMAP ON THE BRAIN SURFACE MODEL [Notice] spmT_*.img must be coregistered to T1-structural image used for creating a brain file [Syntax] vb_fmri_project_Tmap_cortex(brain_file,act_file,area_file,Tthres,SPMimginfo) [Example] > brain_file = 'hoge.brain.mat'; > act_file = 'hoge.act.mat'; > area_file = 'hoge.area.mat'; > Tthres = 5; > Rthres = 3; > SPMimginfo = struct('dirname', '/home/hoge/hoge/spm/',... > imgfilenames,{'spmT_0001.img','spmT_0002.img'},imglabels,{'Right index',... > 'Right hand gripping'}); > vbdot_fmri_project_Tmap_cortex(brain_file,act_file,areafile,Tthres,Rthres,SPMimginfo) [Input] brain_file : cortical surface model act_file : act file area_file : area file Tthres : T-value threshold Rthres : radius threshold (mm) SPMimginfo(ii) : arrays of struct containing information of T-image .dirname : directory name for image file .imgfilename : file name of image to be projected .imglabel : label of image to be projected. These label are used as actkey and areakey. [Optional] loadVmni : if specfied as 1, loading coordinate of brain file as MNI coordinate [Output] Acts are added to "act_file" and Areas are added to "area_file" 2016/07/12 O.Yamashita * add loadVmni to input arguments to switch coordinate of brain file 2016/07/06 O.Yamashita * solve the region expansion problem 2016/07/01 O.Yamashita * first version based on vbdot_fmri_project_Tmap_corext.m Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function vb_fmri_project_Tmap_cortex(brain_file,act_file,area_file,Tthres,Rthres,SPMimginfo,loadVmni) 0002 % PROJECT VOXEL TMAP ON THE BRAIN SURFACE MODEL 0003 % 0004 % [Notice] 0005 % spmT_*.img must be coregistered to T1-structural image used for creating 0006 % a brain file 0007 % 0008 % [Syntax] 0009 % vb_fmri_project_Tmap_cortex(brain_file,act_file,area_file,Tthres,SPMimginfo) 0010 % 0011 % [Example] 0012 % > brain_file = 'hoge.brain.mat'; 0013 % > act_file = 'hoge.act.mat'; 0014 % > area_file = 'hoge.area.mat'; 0015 % > Tthres = 5; 0016 % > Rthres = 3; 0017 % > SPMimginfo = struct('dirname', '/home/hoge/hoge/spm/',... 0018 % > imgfilenames,{'spmT_0001.img','spmT_0002.img'},imglabels,{'Right index',... 0019 % > 'Right hand gripping'}); 0020 % > vbdot_fmri_project_Tmap_cortex(brain_file,act_file,areafile,Tthres,Rthres,SPMimginfo) 0021 % 0022 % [Input] 0023 % brain_file : cortical surface model 0024 % act_file : act file 0025 % area_file : area file 0026 % Tthres : T-value threshold 0027 % Rthres : radius threshold (mm) 0028 % SPMimginfo(ii) : arrays of struct containing information of T-image 0029 % .dirname : directory name for image file 0030 % .imgfilename : file name of image to be projected 0031 % .imglabel : label of image to be projected. These label 0032 % are used as actkey and areakey. 0033 % 0034 % [Optional] 0035 % loadVmni : if specfied as 1, loading coordinate of brain file as MNI coordinate 0036 % 0037 % [Output] 0038 % Acts are added to "act_file" and Areas are added to "area_file" 0039 % 0040 % 2016/07/12 O.Yamashita 0041 % * add loadVmni to input arguments to switch coordinate of brain file 0042 % 2016/07/06 O.Yamashita 0043 % * solve the region expansion problem 0044 % 2016/07/01 O.Yamashita 0045 % * first version based on vbdot_fmri_project_Tmap_corext.m 0046 % 0047 % Copyright (C) 2011, ATR All Rights Reserved. 0048 % License : New BSD License(see VBMEG_LICENSE.txt) 0049 0050 fprintf('============== NOTICE ==========================\n') 0051 fprintf('Please confirm spmT_*.img have been coregistered \n') 0052 fprintf('to the T1-structural image used for creating \n'); 0053 fprintf('a brain file. \n'); 0054 fprintf('================================================\n') 0055 0056 if nargin < 7 0057 loadVmni = 0; 0058 end 0059 0060 0061 spmdir = SPMimginfo(1).dirname; 0062 0063 fprintf('Image directory name : %s,...\n', spmdir); 0064 for jj = 1 : length(SPMimginfo), 0065 fprintf('%s will be registered as %s ...\n', SPMimginfo(jj).imgfilename, SPMimginfo(jj).imglabel); 0066 end 0067 0068 0069 for jj = 1 : length(SPMimginfo), 0070 loadimgfile = [spmdir SPMimginfo(jj).imgfilename]; 0071 key = SPMimginfo(jj).imglabel; 0072 0073 % surface mesh 0074 if loadVmni 0075 V = vb_load_cortex(brain_file, 'MNI'); 0076 else 0077 V = vb_load_cortex(brain_file, 'subj'); 0078 end 0079 V = V * 1000; % mm 0080 0081 0082 % vox image and coordinates 0083 VG=spm_vol(loadimgfile); 0084 [map,XYZ] = spm_read_vols(VG); 0085 0086 % 0087 % thresholding affects resulting surface image !!! 0088 % 0089 0090 % map(map < Tthres) = 0; 0091 % XYZ = XYZ(:,map~=0); 0092 % map = map(map ~= 0)'; 0093 0094 ix = find(map~=0); % brain mask 0095 XYZ = XYZ(:,ix); 0096 map = map(ix); 0097 map(map < Tthres) = 0; % 0098 0099 0100 r2thres = Rthres^2; % half of diagonal line of cuboid 0101 0102 0103 % vox --> surf 0104 Tval = vb_voximg2surimg(XYZ',map(:),V, r2thres, 1); 0105 0106 0107 % add act 0108 fprintf('\nAdd T-map to %s with act-key %s \n', act_file, key) 0109 act.xxP = Tval; 0110 act.key = key; 0111 act.spmdir = spmdir; 0112 act.imgname = SPMimginfo(jj).imgfilename; 0113 vb_add_act(act_file, act, [], OFF); 0114 0115 % add area 0116 fprintf('Add T-map to %s with area-key %s \n', area_file, key) 0117 area.Iextract = find(Tval~=0); 0118 area.key = key; 0119 area.spmdir = spmdir; 0120 area.imgname = SPMimginfo(jj).imgfilename; 0121 vb_add_area(area_file, area, [], OFF); 0122 0123 0124 end