Home > functions > job > job_plot_meg_dir > job_plot_meg_print_spatialpattern.m

job_plot_meg_print_spatialpattern

PURPOSE ^

Print contourmap of MEG signal. Invoked by job_plot_meg.

SYNOPSIS ^

function job_plot_meg_print_spatialpattern(inst_id)

DESCRIPTION ^

 Print contourmap of MEG signal. Invoked by job_plot_meg.

 [syntax]
 job_plot_meg_print_spatialpattern(inst_id)

 [history]
 ????-??-?? Masanori Osako
 2008-12-09 Taku Yoshioka
 2011-01-18 taku-y
  [minor] Printing properties got by vb_property_dlg. 

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function job_plot_meg_print_spatialpattern(inst_id)
0002 % Print contourmap of MEG signal. Invoked by job_plot_meg.
0003 %
0004 % [syntax]
0005 % job_plot_meg_print_spatialpattern(inst_id)
0006 %
0007 % [history]
0008 % ????-??-?? Masanori Osako
0009 % 2008-12-09 Taku Yoshioka
0010 % 2011-01-18 taku-y
0011 %  [minor] Printing properties got by vb_property_dlg.
0012 %
0013 % Copyright (C) 2011, ATR All Rights Reserved.
0014 % License : New BSD License(see VBMEG_LICENSE.txt)
0015 
0016 global vbmeg_inst; 
0017 if isempty(vbmeg_inst.plotmeg{inst_id}.bexp), return; end
0018 
0019 %
0020 % Global variables
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 % Select sensor
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 % Figure property dialog
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 % Draw and print contourmap
0068 %
0069 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0070 
0071 % Colormap
0072 clim = [-c c];
0073 %if get(cb1,'Value')==get(cb1,'Max')
0074 %  clim = 0.7*[-cc_max cc_max];
0075 %else
0076 %  clim = [-1*max(abs(bexp0)) max(abs(bexp0))];
0077 %end
0078 
0079 % Display figure
0080 h = figure; 
0081 %job_plot_meg_plot2D(pick(:,1:3),bexp0,clim);
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 % Print figure
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;

Generated on Tue 27-Aug-2013 11:46:04 by m2html © 2005