Home > functions > job > job_plot_meg_dir > job_plot_meg_print_timecourse.m

job_plot_meg_print_timecourse

PURPOSE ^

Print temporal pattern of MEG signal. Invoked by job_plot_meg.

SYNOPSIS ^

function job_plot_meg_print_timecourse(inst_id)

DESCRIPTION ^

 Print temporal pattern of MEG signal. Invoked by job_plot_meg.

 [syntax]
 job_plot_meg_print_temporalpattern(inst_id)

 [history]
 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_timecourse(inst_id)
0002 % Print temporal pattern of MEG signal. Invoked by job_plot_meg.
0003 %
0004 % [syntax]
0005 % job_plot_meg_print_temporalpattern(inst_id)
0006 %
0007 % [history]
0008 % 2008-12-09 Taku Yoshioka
0009 % 2011-01-18 taku-y
0010 %  [minor] Printing properties got by vb_property_dlg.
0011 %
0012 % Copyright (C) 2011, ATR All Rights Reserved.
0013 % License : New BSD License(see VBMEG_LICENSE.txt)
0014 
0015 global vbmeg_inst; 
0016 if isempty(vbmeg_inst.plotmeg{inst_id}.bexp), return; end
0017 
0018 %
0019 % Global variables
0020 %
0021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0022 T           = vbmeg_inst.plotmeg{inst_id}.T;
0023 N           = vbmeg_inst.plotmeg{inst_id}.N;
0024 t           = vbmeg_inst.plotmeg{inst_id}.t;
0025 n_trial     = vbmeg_inst.plotmeg{inst_id}.n_trial;
0026 MEGinfo     = vbmeg_inst.plotmeg{inst_id}.MEGinfo;
0027 rb1         = vbmeg_inst.plotmeg{inst_id}.rb1;
0028 ed5         = vbmeg_inst.plotmeg{inst_id}.ed5;
0029 sensor_type = vbmeg_inst.plotmeg{inst_id}.sensor_type;
0030 
0031 %
0032 % Get sensor indices
0033 %
0034 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0035 if sensor_type~=-1, 
0036   ix = find(MEGinfo.ChannelInfo.Type==sensor_type);
0037   N = length(ix);
0038 else
0039   ix = 1:(size(vbmeg_inst.plotmeg{inst_id}.bexp(:,:,n_trial),1));
0040 end
0041 
0042 %
0043 % Figure property dialog
0044 %
0045 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0046 property_names = {'Show TOI','xlim','ylim'};
0047 xx = [ceil(min(T)) ceil(max(T))];
0048 if get(rb1,'Value')==1, 
0049   tmp = vbmeg_inst.plotmeg{inst_id}.bexp(ix,:,n_trial);
0050   yy = max(sqrt(sum(tmp.^2,1)));
0051   yy = ceil(yy/(10^(floor(log10(yy))-1)))*(10^(floor(log10(yy))-1));
0052   yy = [0 yy];
0053 else
0054   yy = max(max(abs(vbmeg_inst.plotmeg{inst_id}.bexp(ix,:,n_trial))));
0055   yy = ceil(yy/(10^(floor(log10(yy))-1)))*(10^(floor(log10(yy))-1));
0056   yy = [-yy yy];
0057 end
0058 default_values = {'1',num2str(xx),num2str(yy)};
0059 description    ...
0060     = {'Show TOI (1) or not (0)', ...
0061        'Start and end of time course', ...
0062        'Min and max of signal'};
0063 values = vb_property_dlg(property_names,default_values,description);
0064 
0065 if isempty(values),
0066   return;
0067 end
0068 
0069 is_toi = str2num(values{1});
0070 xx     = str2num(values{2});
0071 yy     = str2num(values{3});
0072 
0073 if xx(1)>xx(2), 
0074   tmp = xx(1);
0075   xx(1) = xx(2);
0076   xx(2) = tmp;
0077 end
0078 
0079 if yy(1)>yy(2), 
0080   tmp = yy(1);
0081   yy(1) = yy(2);
0082   yy(2) = tmp;
0083 end
0084 
0085 %
0086 % Print temporal pattern
0087 %
0088 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0089 h = figure; 
0090 
0091 if get(rb1,'Value')==1, 
0092   tmp = vbmeg_inst.plotmeg{inst_id}.bexp(ix,:,n_trial);
0093   plot(T,sqrt(sum(tmp.^2,1)),'LineWidth',2);
0094 else
0095   plot(repmat(T,[N 1])',...
0096        vbmeg_inst.plotmeg{inst_id}.bexp(ix,:,n_trial)');
0097 end
0098 
0099 xlim(xx);
0100 ylim(yy);
0101 %xlim([min(T) max(T)]);
0102 set(gca,'FontSize',13.5);
0103 xlabel('Time [ms]','FontSize',13.5);
0104 ylabel('MEG signal [fT]','FontSize',13.5);
0105 pos = get(gca,'Position');
0106 set(gca,'Position',[pos(1) pos(2)+0.05 pos(3) pos(4)-0.05]);
0107 hold on;
0108 
0109 if is_toi, 
0110   y = ylim;
0111   X = [t(1) t(2) t(2) t(1) t(1)];
0112   Y = [y(1) y(1) y(2) y(2) y(1)];
0113   set(gca,'YLimMode','manual');
0114   plot(X,Y,'k','LineWidth',0.5);
0115 end
0116 
0117 % Print figure
0118 vb_epsfig(h,0.5,15);
0119 
0120 [fig_dir,fig_file] = vb_file_select({'.eps'},'Save figure',true);
0121 
0122 if ~isempty(fig_file), 
0123   figfile = [fig_dir filesep fig_file{1}];
0124   print(h,'-depsc',figfile);
0125 end
0126 
0127 close(h);
0128 
0129 return;

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