0001 function job_plot_currentmap(brain_file,curr_file,ix_trial,area_file,act_file)
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
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130 if nargin<5, act_file = ''; end
0131 if nargin<4, area_file = ''; end
0132 if nargin<3, ix_trial = 1; end
0133 if nargin<2, curr_file = ''; end
0134 if nargin<1, brain_file = ''; end
0135
0136 inst_id = create_instance;
0137 if isempty(inst_id), return; end
0138
0139
0140 if ~exist('model', 'var'), model =0; end
0141 if model ~= 0, model = 1; end
0142
0143
0144
0145
0146
0147 create_GUI(inst_id,brain_file,curr_file,ix_trial,area_file,act_file, ...
0148 model);
0149 job_plot_cmap_update_filterradius(inst_id);
0150 job_plot_cmap_update_timecourse(inst_id);
0151 job_plot_cmap_update_spatialpattern(inst_id);
0152
0153 return;
0154
0155
0156
0157
0158
0159 function inst_id = create_instance
0160
0161 global vbmeg_inst
0162
0163 if isfield(vbmeg_inst,'plotcmap'),
0164 for inst_id=1:vbmeg_inst.const.PLOTCMAP_MAX
0165 if isempty(vbmeg_inst.plotcmap{inst_id}), return; end;
0166 end
0167 vb_disp(['The number of instances of ''job_plot_currentmap''' ...
0168 ' GUIs reaches the maximum number.']);
0169 inst_id = [];
0170 elseif isfield(vbmeg_inst,'const'),
0171 vbmeg_inst.plotcmap = cell(vbmeg_inst.const.PLOTCMAP_MAX,1);
0172 inst_id = 1;
0173 else
0174 vb_disp(['''vbmeg_inst'' was not correct. You have to invoke' ...
0175 '''vbmeg'' to create an instance of VBMEG.']);
0176 inst_id = [];
0177 end
0178
0179 return;
0180
0181
0182
0183
0184
0185 function create_GUI(inst_id,brain_file,curr_file,ix_trial,area_file, ...
0186 act_file,model)
0187
0188 global vbmeg_inst;
0189
0190
0191
0192
0193
0194
0195
0196 plotcmap.brain_file = '';
0197 plotcmap.V = [];
0198 plotcmap.Vinf = [];
0199 plotcmap.F = [];
0200 plotcmap.inf_C = [];
0201 plotcmap.xxA = [];
0202 plotcmap.Vtal = [];
0203 plotcmap.nextDD = [];
0204 plotcmap.nextIX = [];
0205
0206
0207 Jmin_plot = 0;
0208 Jmax_plot = 1;
0209 plotcmap.curr_file = '';
0210 plotcmap.Jact = [];
0211 plotcmap.Jmax = [];
0212 plotcmap.Jmin = [];
0213 plotcmap.Jmax_plot = Jmax_plot;
0214 plotcmap.Jmin_plot = Jmin_plot;
0215 plotcmap.ix_trial = 1;
0216 plotcmap.ave_mode = true;
0217 plotcmap.toi = [];
0218 plotcmap.foi = [];
0219 plotcmap.Jinfo = [];
0220
0221
0222 plotcmap.tf_file = '';
0223 plotcmap.data = [];
0224 plotcmap.TFinfo = [];
0225 plotcmap.TFmax = [];
0226 plotcmap.TFmin = [];
0227 plotcmap.TFmin_plot = 0;
0228 plotcmap.TFmax_plot = 1;
0229
0230
0231 plotcmap.act_file = '';
0232 plotcmap.xxP = [];
0233
0234
0235 plotcmap.area_file = '';
0236 plotcmap.area_key = [];
0237
0238
0239 plotcmap.plot_parm = vb_set_plot_parm;
0240 plotcmap.plot_parm.index = [];
0241 plotcmap.plot_parm.LRflag = 'LR';
0242 plotcmap.ix_peak = 1;
0243 plotcmap.J_hold = [];
0244
0245
0246
0247 plotcmap.Jbck = [];
0248 plotcmap.ix_act = [];
0249 plotcmap.ix_bck = [];
0250 plotcmap.Tstart = [];
0251 plotcmap.T = [];
0252 plotcmap.t = [];
0253 plotcmap.patch_norm = [];
0254
0255
0256
0257
0258
0259 h_fig = open('job_plot_cmap.fig');
0260 set(h_fig,'HandleVisibility','on');
0261 set(h_fig,'Pointer','watch');
0262 drawnow;
0263
0264
0265 plotcmap.model_type = model;
0266
0267
0268
0269
0270
0271 plotcmap.h_fig = h_fig;
0272 plotcmap.h_time = get_child_handle(h_fig,'plot_time');
0273 plotcmap.h_space = get_child_handle(h_fig,'plot_brain');
0274 plotcmap.h_cbar = get_child_handle(h_fig,'colorbar');
0275 plotcmap.h_cbar_tf = get_child_handle(h_fig,'colorbar_tf');
0276 plotcmap.ed1 = get_child_handle(h_fig,'trial_number');
0277 plotcmap.ed2 = get_child_handle(h_fig,'time_window_start');
0278 plotcmap.ed3 = get_child_handle(h_fig,'time_window_end');
0279 plotcmap.ed4 = get_child_handle(h_fig,'ix_peak');
0280 plotcmap.ed5 = get_child_handle(h_fig,'spatial_peak_size');
0281 plotcmap.ed6 = get_child_handle(h_fig,'tal_coord');
0282 plotcmap.ed7 = get_child_handle(h_fig,'temporal_peak_size');
0283 plotcmap.ed8 = get_child_handle(h_fig,'freq_window_min');
0284 plotcmap.ed9 = get_child_handle(h_fig,'freq_window_max');
0285 plotcmap.ed10 = get_child_handle(h_fig,'Jmax_tf_plot_edit');
0286 plotcmap.ed11 = get_child_handle(h_fig,'act_file');
0287 plotcmap.ed12 = get_child_handle(h_fig,'area_file');
0288 plotcmap.pb1 = get_child_handle(h_fig,'print_brain');
0289 plotcmap.pb2 = get_child_handle(h_fig,'print_time');
0290 plotcmap.pb3 = get_child_handle(h_fig,'rotate');
0291 plotcmap.pb4 = get_child_handle(h_fig,'move_forward');
0292 plotcmap.pb5 = get_child_handle(h_fig,'move_forward_fast');
0293 plotcmap.pb6 = get_child_handle(h_fig,'move_back');
0294 plotcmap.pb7 = get_child_handle(h_fig,'move_back_fast');
0295 plotcmap.pb8 = get_child_handle(h_fig,'search_spatial_peak');
0296 plotcmap.pb9 = get_child_handle(h_fig,'search_temporal_peak');
0297 plotcmap.pb10 = get_child_handle(h_fig,'register_activity');
0298 plotcmap.pb11 = get_child_handle(h_fig,'select_vertex');
0299 plotcmap.pb12 = get_child_handle(h_fig,'register_area');
0300 plotcmap.pb13 = get_child_handle(h_fig,'left_button');
0301 plotcmap.pb14 = get_child_handle(h_fig,'right_button');
0302 plotcmap.pb15 = get_child_handle(h_fig,'top_button');
0303 plotcmap.pb16 = get_child_handle(h_fig,'bottom_button');
0304 plotcmap.pb17 = get_child_handle(h_fig,'front_button');
0305 plotcmap.pb18 = get_child_handle(h_fig,'back_button');
0306 plotcmap.rb1 = get_child_handle(h_fig,'talairach');
0307 plotcmap.rb2 = get_child_handle(h_fig,'mni');
0308 plotcmap.cb1 = get_child_handle(h_fig,'fix_colorbar');
0309 plotcmap.cb2 = get_child_handle(h_fig,'left_brain');
0310 plotcmap.cb3 = get_child_handle(h_fig,'right_brain');
0311 plotcmap.cb4 = get_child_handle(h_fig,'hold_on');
0312 plotcmap.cb5 = get_child_handle(h_fig,'show_roi');
0313 plotcmap.cb6 = get_child_handle(h_fig,'fix_colorbar_tf');
0314 plotcmap.cb7 = get_child_handle(h_fig,'show_act_map');
0315 plotcmap.cb8 = get_child_handle(h_fig,'show_cortical_area');
0316 plotcmap.lb1 = get_child_handle(h_fig,'act_key_list');
0317 plotcmap.lb2 = get_child_handle(h_fig,'area_key_list');
0318 plotcmap.lb3 = get_child_handle(h_fig,'cortical_area');
0319 plotcmap.Jmin_plot_edit = get_child_handle(h_fig, 'Jmin_plot_edit');
0320 plotcmap.Jmax_plot_edit = get_child_handle(h_fig, 'Jmax_plot_edit');
0321 plotcmap.model_type_original_rb ...
0322 = get_child_handle(h_fig,'model_type_original_rb');
0323 plotcmap.model_type_inflate_rb ...
0324 = get_child_handle(h_fig,'model_type_inflate_rb');
0325 plotcmap.load_data_menu ...
0326 = get_child_handle(get_child_handle(h_fig,'file_menu'), ...
0327 'load_data_menu');
0328 plotcmap.loaded_files_menu ...
0329 = get_child_handle(get_child_handle(h_fig,'file_menu'), ...
0330 'loaded_files_menu');
0331 plotcmap.close_menu ...
0332 = get_child_handle(get_child_handle(h_fig,'file_menu'), ...
0333 'close_menu');
0334
0335
0336 set(plotcmap.ed1,'String','1');
0337 set(plotcmap.ed1,'Enable','off')
0338
0339
0340
0341
0342
0343 inst_str = num2str(inst_id);
0344 plotcmap_str = ['vbmeg_inst.plotcmap{' inst_str '}'];
0345
0346
0347 command = ['global vbmeg_inst; '...
0348 'vbmeg_inst.plotcmap{' inst_str '}=[];'];
0349 set(h_fig,'DeleteFcn',command);
0350
0351
0352 command = ['job_plot_cmap_push_rotate_button(' inst_str ');'];
0353 set(plotcmap.pb3,'Callback',command);
0354
0355
0356 command = ['job_plot_cmap_change_trial(' inst_str ');'];
0357 set(plotcmap.ed1,'Callback',command);
0358
0359
0360 command = ['global vbmeg_inst; ' ...
0361 plotcmap_str '.toi(1)=' ...
0362 'str2num(get(' plotcmap_str '.ed2,''String''));' ...
0363 'job_plot_cmap_update_timecourse(' inst_str ');' ...
0364 'job_plot_cmap_update_spatialpattern(' inst_str ');'];
0365 set(plotcmap.ed2,'Callback',command);
0366 command = ['global vbmeg_inst; ' ...
0367 plotcmap_str '.toi(2)=' ...
0368 'str2num(get(' plotcmap_str '.ed3,''String''));' ...
0369 'job_plot_cmap_update_timecourse(' inst_str ');' ...
0370 'job_plot_cmap_update_spatialpattern(' inst_str ');'];
0371 set(plotcmap.ed3,'Callback',command);
0372
0373
0374 command = ['global vbmeg_inst; ' ...
0375 plotcmap_str '.foi(1)=' ...
0376 'str2num(get(' plotcmap_str '.ed8,''String''));' ...
0377 'job_plot_cmap_update_timecourse(' inst_str ');' ...
0378 'job_plot_cmap_update_spatialpattern(' inst_str ');'];
0379 set(plotcmap.ed8,'Callback',command);
0380 command = ['global vbmeg_inst; ' ...
0381 plotcmap_str '.foi(2)=' ...
0382 'str2num(get(' plotcmap_str '.ed9,''String''));' ...
0383 'job_plot_cmap_update_timecourse(' inst_str ');' ...
0384 'job_plot_cmap_update_spatialpattern(' inst_str ');'];
0385 set(plotcmap.ed9,'Callback',command);
0386
0387
0388 command = ['global vbmeg_inst; '...
0389 'dt = ' plotcmap_str '.toi(2)-' plotcmap_str '.toi(1);' ...
0390 plotcmap_str '.toi=' plotcmap_str '.toi+dt;' ...
0391 'job_plot_cmap_update_timecourse(' inst_str ');' ...
0392 'job_plot_cmap_update_spatialpattern(' inst_str ');'];
0393 set(plotcmap.pb4,'Callback',command);
0394 command = ['global vbmeg_inst; '...
0395 'dt = ' plotcmap_str '.toi(2)-' plotcmap_str '.toi(1);' ...
0396 plotcmap_str '.toi=' plotcmap_str '.toi+5*dt;' ...
0397 'job_plot_cmap_update_timecourse(' inst_str ');' ...
0398 'job_plot_cmap_update_spatialpattern(' inst_str ');'];
0399 set(plotcmap.pb5,'Callback',command);
0400 command = ['global vbmeg_inst; '...
0401 'dt = ' plotcmap_str '.toi(2)-' plotcmap_str '.toi(1);' ...
0402 plotcmap_str '.toi=' plotcmap_str '.toi-dt;' ...
0403 'job_plot_cmap_update_timecourse(' inst_str ');' ...
0404 'job_plot_cmap_update_spatialpattern(' inst_str ');'];
0405 set(plotcmap.pb6,'Callback',command);
0406 command = ['global vbmeg_inst; '...
0407 'dt = ' plotcmap_str '.toi(2)-' plotcmap_str '.toi(1);' ...
0408 plotcmap_str '.toi=' plotcmap_str '.toi-5*dt;' ...
0409 'job_plot_cmap_update_timecourse(' inst_str ');' ...
0410 'job_plot_cmap_update_spatialpattern(' inst_str ');'];
0411 set(plotcmap.pb7,'Callback',command);
0412
0413
0414 command = ['job_plot_cmap_spatial_peak(' inst_str ');'];
0415 set(plotcmap.pb8,'Callback',command);
0416 command = ['job_plot_cmap_temporal_peak(' inst_str ');'];
0417 set(plotcmap.pb9,'Callback',command);
0418
0419
0420 command = ['job_plot_cmap_change_Jplot(' inst_str ');'];
0421 set(plotcmap.Jmin_plot_edit,'Callback',command);
0422 set(plotcmap.Jmax_plot_edit,'Callback',command);
0423 set(plotcmap.Jmin_plot_edit,'String','');
0424 set(plotcmap.Jmax_plot_edit,'String','');
0425
0426
0427 command = ['job_plot_cmap_change_Jplot_tf(' inst_str ');'];
0428 set(plotcmap.ed10,'Callback',command);
0429 set(plotcmap.ed10,'String','');
0430
0431
0432 command = ['job_plot_cmap_print_spatialpattern(' inst_str ');'];
0433 set(plotcmap.pb1,'Callback',command);
0434 command = ['job_plot_cmap_print_temporalpattern(' inst_str ');'];
0435 set(plotcmap.pb2,'Callback',command);
0436
0437
0438 command = ['global vbmeg_inst;' ...
0439 plotcmap_str '.ix_peak = ' ...
0440 'str2num(get(' plotcmap_str '.ed4,''String''));' ...
0441 'job_plot_cmap_update_timecourse(' inst_str ');' ...
0442 'job_plot_cmap_update_spatialpattern(' inst_str ');'];
0443 set(plotcmap.ed4,'Callback',command);
0444
0445
0446 command = ['global vbmeg_inst;' ...
0447 'job_plot_cmap_change_talcoord(' inst_str ');'];
0448 set(plotcmap.ed6,'Callback',command);
0449
0450
0451 command = ['job_plot_cmap_update_filterradius(' inst_str ');' ...
0452 'job_plot_cmap_update_spatialpattern(' inst_str ');' ...
0453 'job_plot_cmap_update_timecourse(' inst_str ');'];
0454 set(plotcmap.ed5,'Callback',command);
0455
0456
0457 command = ['job_plot_cmap_register_activity(' inst_str ');'];
0458 set(plotcmap.pb10,'Callback',command);
0459
0460
0461 command = ['job_plot_cmap_register_area(' inst_str ');'];
0462 set(plotcmap.pb12,'Callback',command);
0463
0464
0465 command = ['job_plot_cmap_change_rb1(' inst_str ');'];
0466 set(plotcmap.rb1,'Callback',command);
0467 command = ['job_plot_cmap_change_rb2(' inst_str ');'];
0468 set(plotcmap.rb2,'Callback',command);
0469
0470
0471 command = ['job_plot_cmap_holdon(' inst_str ');'];
0472 set(plotcmap.cb4,'Callback',command);
0473
0474
0475 command = ['job_plot_cmap_show_roi(' inst_str ');'];
0476 set(plotcmap.cb5,'Callback',command);
0477
0478
0479 command = ['job_plot_cmap_selvertex(' inst_str ');'];
0480 set(plotcmap.pb11,'Callback',command);
0481
0482
0483 command = ['job_plot_cmap_update_colorbarscale(' inst_str ');'];
0484 set(plotcmap.cb1,'Callback',command);
0485 set(plotcmap.cb6,'Callback',command);
0486
0487
0488 command = ['job_plot_cmap_update_spatialpattern(' inst_str ');'];
0489 set(plotcmap.cb2,'Callback',command);
0490 set(plotcmap.cb3,'Callback',command);
0491
0492
0493 command = ['job_plot_cmap_update_colorbarscale(' inst_str ');' ...
0494 'job_plot_cmap_update_spatialpattern(' inst_str ');'];
0495 set(plotcmap.cb7,'Callback',command);
0496
0497
0498
0499
0500 command = ['job_plot_cmap_update_spatialpattern(' inst_str ');'];
0501 set(plotcmap.cb8,'Callback',command);
0502
0503
0504 command = ['global vbmeg_inst; '...
0505 'job_plot_cmap_update_xxP(' inst_str ');' ...
0506 'job_plot_cmap_update_colorbarscale(' inst_str ');' ...
0507 'job_plot_cmap_update_spatialpattern(' inst_str ');'];
0508 set(plotcmap.lb1,'Callback',command);
0509
0510
0511 command = ['global vbmeg_inst; '...
0512 'job_plot_cmap_update_area(' inst_str ');' ...
0513 'job_plot_cmap_update_spatialpattern(' inst_str ');'];
0514 set(plotcmap.lb2,'Callback',command);
0515
0516
0517 model_type_group = [plotcmap.model_type_inflate_rb,
0518 plotcmap.model_type_original_rb];
0519 command = ['job_plot_cmap_change_modeltype(' inst_str ');'];
0520 set(model_type_group, 'Callback', command);
0521 set(model_type_group, 'Value', 0);
0522 if model == 0
0523 set(plotcmap.model_type_inflate_rb, 'Value', 1);
0524 else
0525 set(plotcmap.model_type_original_rb, 'Value', 1);
0526 end
0527
0528
0529 set(h_fig,'WindowButtonUpFcn','rotate3d off;');
0530
0531
0532 command = ['job_plot_cmap_load_data(' inst_str ');'];
0533 set(plotcmap.load_data_menu, 'Callback', command);
0534
0535
0536 command = ['job_plot_cmap_show_loaded_files(' inst_str ');'];
0537 set(plotcmap.loaded_files_menu, 'Callback', command);
0538
0539
0540 command = 'close;';
0541 set(plotcmap.close_menu,'Callback',command);
0542
0543
0544 command = ['job_plot_cmap_change_angle(' inst_str ',''left'');' ...
0545 'job_plot_cmap_update_camera(' inst_str ');'];
0546 set(plotcmap.pb13,'Callback',command);
0547 command = ['job_plot_cmap_change_angle(' inst_str ',''right'');' ...
0548 'job_plot_cmap_update_camera(' inst_str ');'];
0549 set(plotcmap.pb14,'Callback',command);
0550 command = ['job_plot_cmap_change_angle(' inst_str ',''top'');' ...
0551 'job_plot_cmap_update_camera(' inst_str ');'];
0552 set(plotcmap.pb15,'Callback',command);
0553 command = ['job_plot_cmap_change_angle(' inst_str ',''bottom'');' ...
0554 'job_plot_cmap_update_camera(' inst_str ');'];
0555 set(plotcmap.pb16,'Callback',command);
0556 command = ['job_plot_cmap_change_angle(' inst_str ',''front'');' ...
0557 'job_plot_cmap_update_camera(' inst_str ');'];
0558 set(plotcmap.pb17,'Callback',command);
0559 command = ['job_plot_cmap_change_angle(' inst_str ',''back'');' ...
0560 'job_plot_cmap_update_camera(' inst_str ');'];
0561 set(plotcmap.pb18,'Callback',command);
0562
0563
0564
0565
0566
0567 set(h_fig,'Renderer','zbuffer');
0568 set(h_fig,'CurrentAxes',plotcmap.h_space);
0569 axis off;
0570
0571
0572
0573
0574
0575
0576
0577
0578 vbmeg_inst.plotcmap{inst_id} = plotcmap;
0579
0580
0581 set(h_fig,'Pointer','arrow');
0582
0583
0584
0585
0586
0587 parms = [];
0588
0589 if ~isempty(brain_file),
0590 parms.brain_file = brain_file;
0591 end
0592
0593 if ~isempty(curr_file),
0594 [tmp1,tmp2] = fileparts(curr_file);
0595 [tmp1,tmp2,str_ext] = fileparts([tmp1 filesep tmp2]);
0596
0597 switch str_ext
0598 case '.curr',
0599 parms.curr_file = curr_file;
0600 parms.tf_file = [];
0601
0602 case '.tf',
0603 parms.curr_file = [];
0604 parms.tf_file = curr_file;
0605
0606 otherwise,
0607 vb_disp('WARNING',['Invalid extention for curr_file (job_plot_' ...
0608 'currentmap.m)']);
0609 end
0610 end
0611
0612 if ~isempty(ix_trial),
0613 parms.ix_trial = ix_trial;
0614 parms.ave_mode = false;
0615 end
0616
0617 if ~isempty(area_file),
0618 parms.area_file = area_file;
0619 end
0620
0621 if ~isempty(act_file),
0622 parms.act_file = act_file;
0623 end
0624
0625 job_plot_cmap_load_data(inst_id,parms);
0626
0627 return;