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 vb_plot_sensor_2d(pick(:,1:3),bexp0,clim);
0067 axis off;
0068 axis equal;
0069 axis tight;
0070 colormap(jet);
0071
0072 colorbar;