0001 function [Vindx ,V, F] = vb_job_reduced_cortex(proj_root,brain_parm);
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 proj_root = vb_rm_trailing_slash(proj_root);
0027
0028 const = vb_define_verbose;
0029 VERBOSE_LEVEL_NOTICE = const.VERBOSE_LEVEL_NOTICE;
0030
0031
0032 plot_mode = 1;
0033
0034 brain_file = [proj_root filesep brain_parm.brain_file];
0035 area_file = [proj_root filesep brain_parm.area_file ];
0036 act_file = [proj_root filesep brain_parm.act_file ];
0037
0038
0039 [udir, fname] = fileparts(brain_parm.analyze_file);
0040 MRI_ID = fname;
0041
0042
0043 if isfield(brain_parm,'reduce_brain')
0044 reduce_brain = brain_parm.reduce_brain;
0045 else
0046 reduce_brain = 1/3;
0047 end
0048
0049
0050 if isfield(brain_parm,'R_normal')
0051 Rmax = brain_parm.R_normal;
0052 else
0053 Rmax = 0.004;
0054 end
0055
0056
0057
0058
0059 tic
0060 vb_disp('Make reduced cortex', VERBOSE_LEVEL_NOTICE);
0061 Vindx = [];
0062 [Vindx ,V, F, xx, Vinfo] = vb_reduce_cortex(brain_file,Vindx,reduce_brain);
0063 vb_ptime(toc)
0064
0065
0066 area_key = 'reduced_cortex';
0067 AreaNew.key = area_key;
0068 AreaNew.Iextract = Vindx(:);
0069 vb_add_area(area_file,AreaNew,[],OFF);
0070
0071
0072
0073
0074 tic;
0075 vb_disp_nonl('Search next-point index and distance: ', VERBOSE_LEVEL_NOTICE);
0076
0077 [xxD, xxF, xxT] = vb_next_distance( F.F3, V );
0078
0079 vb_disp(sprintf('%f[sec]',toc), VERBOSE_LEVEL_NOTICE);
0080
0081
0082
0083
0084 tic
0085
0086 [xxA] = vb_calc_patch_area(V, F.F3, xxT);
0087
0088 vb_disp(sprintf('%f[sec]',toc), VERBOSE_LEVEL_NOTICE);
0089
0090
0091
0092
0093 [nextDD, nextIX] = vb_load_cortex_neighbour(brain_file) ;
0094 [nextIX, nextDD] = vb_reduce_neighbor_data(Vindx,nextIX,nextDD);
0095
0096
0097 add_name = '_reduce';
0098 brain_file2 = vb_change_file_basename(brain_file,add_name);
0099 area_file2 = vb_change_file_basename(area_file,add_name);
0100 act_file2 = vb_change_file_basename(act_file,add_name);
0101
0102 vb_disp('Save brain model ', VERBOSE_LEVEL_NOTICE);
0103 vb_disp(sprintf(' filename = %s', brain_file2), ...
0104 VERBOSE_LEVEL_NOTICE);
0105
0106 vb_save([brain_file2], 'F','V','xx','xxF','xxD','xxA', ...
0107 'Vinfo','nextIX','nextDD','MRI_ID');
0108
0109
0110 Ndipole = size(V,1);
0111
0112
0113 act_new.key = 'Uniform';
0114 act_new.xxP = ones(Ndipole,1);
0115 act_new.comment = 'artificial data';
0116
0117 vb_add_act([act_file2], act_new, MRI_ID, OFF);
0118
0119
0120 AreaNew.key = 'Cortex';
0121 AreaNew.Iextract = [1:Ndipole]';
0122
0123 vb_add_area([area_file2], AreaNew, MRI_ID, OFF);
0124
0125 if plot_mode == 1,
0126
0127
0128 angle = [45 30; -45 30];
0129
0130 figure;
0131 subplot(1,2,1)
0132 vb_plot_surf(V, F.F3L, [],'k', 1, 1);
0133 view(angle(1,:));
0134 title('Reduced left brain')
0135
0136 subplot(1,2,2)
0137 vb_plot_surf(V, F.F3R, [],'k', 1, 1);
0138 view(angle(2,:));
0139 title('Reduced right brain')
0140 end
0141
0142
0143
0144
0145 vb_disp('Find normal statics in brain file', VERBOSE_LEVEL_NOTICE);
0146
0147 [normal_stat , original_info] = ...
0148 vb_cortex_normal_statics(brain_file,area_file,area_key,Rmax);
0149
0150 original_info.brain_file = brain_parm.brain_file;
0151
0152
0153
0154
0155 vb_disp('Save normal statics ', VERBOSE_LEVEL_NOTICE);
0156
0157 vb_save([brain_file2], 'original_info','normal_stat');