0001 function job_plot_meg_update_spatialpattern(inst_id)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 global vbmeg_inst;
0014 if isempty(vbmeg_inst.plotmeg{inst_id}.bexp), return; end
0015
0016
0017
0018
0019
0020 h_fig = vbmeg_inst.plotmeg{inst_id}.h_fig;
0021 h_space = vbmeg_inst.plotmeg{inst_id}.h_space;
0022 n_trial = vbmeg_inst.plotmeg{inst_id}.n_trial;
0023 t = vbmeg_inst.plotmeg{inst_id}.t;
0024 pick = vbmeg_inst.plotmeg{inst_id}.pick;
0025 MEGinfo = vbmeg_inst.plotmeg{inst_id}.MEGinfo;
0026 cb1 = vbmeg_inst.plotmeg{inst_id}.cb1;
0027 cc_max = max(max(abs(vbmeg_inst.plotmeg{inst_id}.bexp(:,:,n_trial))));
0028 pretrigger = vb_meginfo_get_pre_trigger(MEGinfo);
0029 if isempty(pretrigger), pretrigger = 0; end
0030 tt = round((t(1):t(2))*MEGinfo.SampleFreq/1000+pretrigger+1);
0031 bexp0 = mean(vbmeg_inst.plotmeg{inst_id}.bexp(:,tt,n_trial),2)';
0032 ed5 = vbmeg_inst.plotmeg{inst_id}.ed5;
0033
0034
0035
0036
0037
0038 sensor_type = vbmeg_inst.plotmeg{inst_id}.sensor_type;
0039
0040 if sensor_type~=-1,
0041 ix = find(MEGinfo.ChannelInfo.Type==sensor_type);
0042 bexp0 = bexp0(ix);
0043 pick = pick(ix,:);
0044 end
0045
0046
0047
0048
0049
0050
0051
0052 if get(cb1,'Value')==get(cb1,'Max')
0053 c = str2num(get(ed5,'String'));
0054 if c<0, c = abs(c); end
0055 clim = [-c c];
0056
0057 else
0058 c = max(abs(bexp0));
0059 set(ed5,'String',num2str(ceil(c)));
0060 clim = [-c c];
0061
0062 end
0063
0064 set(h_fig,'CurrentAxes',h_space);
0065
0066
0067 vb_plot_sensor_2d(pick(:,1:3),bexp0,clim);
0068 vb_plot_sensor_2d_head_plot_add(gca);
0069
0070
0071 job_plot_meg_choose_plot_sensor(inst_id, 'plot');
0072
0073 set(h_space, 'XtickLabel', []);
0074 set(h_space, 'YtickLabel', []);
0075 set(h_space, 'TickLength', [0 0]);
0076 set(h_space, 'Color', 'none');
0077 set(h_space, 'XColor', get(h_fig, 'Color'));
0078 set(h_space, 'YColor', get(h_fig, 'Color'));
0079
0080 axis equal;
0081 axis tight;
0082 colormap(jet);
0083
0084 colorbar;
0085 cb_str = ['job_plot_meg_choose_plot_sensor(', num2str(inst_id), ',1)'];
0086
0087 set(get(h_space, 'children'), 'HitTest', 'off');
0088 set(h_space, 'HitTest', 'on');
0089 set(h_space, 'ButtonDownFcn', cb_str);
0090