0001 function job_plot_meg_print_spatialpattern(inst_id)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 global vbmeg_inst;
0017 if isempty(vbmeg_inst.plotmeg{inst_id}.bexp), return; end
0018
0019
0020
0021
0022
0023 n_trial = vbmeg_inst.plotmeg{inst_id}.n_trial;
0024 t = vbmeg_inst.plotmeg{inst_id}.t;
0025 pick = vbmeg_inst.plotmeg{inst_id}.pick;
0026 MEGinfo = vbmeg_inst.plotmeg{inst_id}.MEGinfo;
0027 tt = round((t(1):t(2))*MEGinfo.SampleFreq/1000+ ...
0028 vb_meginfo_get_pre_trigger(MEGinfo)+1);
0029 bexp0 = mean(vbmeg_inst.plotmeg{inst_id}.bexp(:,tt,n_trial),2)';
0030 cb1 = vbmeg_inst.plotmeg{inst_id}.cb1;
0031 ed5 = vbmeg_inst.plotmeg{inst_id}.ed5;
0032 cc_max = max(max(abs(vbmeg_inst.plotmeg{inst_id}.bexp(:,:,n_trial))));
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 property_names = {'Colorbar','Max'};
0051 c = str2num(get(ed5,'String'));
0052 if c<0, c=abs(c); end
0053 default_values = {'1',num2str(c)};
0054 description ...
0055 = {'Colorbar is attached (1) or not (0).', ...
0056 'Maximum value of the absolute value plotted.'};
0057 values = vb_property_dlg(property_names,default_values,description);
0058
0059 if isempty(values),
0060 return;
0061 end
0062
0063 is_cbar = str2num(values{1});
0064 c = str2num(values{2});
0065
0066
0067
0068
0069
0070
0071
0072 clim = [-c c];
0073
0074
0075
0076
0077
0078
0079
0080 h = figure;
0081
0082 vb_plot_sensor_2d(pick(:,1:3),bexp0,clim);
0083 axis off;
0084 axis equal;
0085 colormap(jet);
0086 if is_cbar, colorbar; end
0087 axis tight;
0088 set(gca,'Position',[0.1 0.1 0.8 0.8]);
0089
0090
0091 vb_epsfig(h,0.7,15);
0092
0093 [fig_dir,fig_file] = vb_file_select({'.eps'},'Save figure',true);
0094 if ~isempty(fig_file),
0095 figfile = [fig_dir filesep fig_file{1}];
0096 print(h,'-depsc',figfile);
0097 end
0098
0099 close(h);
0100
0101 return;