Home > functions > job > job_plot_currentmap_dir > job_plot_cmap_temporal_peak.m

job_plot_cmap_temporal_peak

PURPOSE ^

Search temporal peak of cortical current timecourse

SYNOPSIS ^

function job_plot_cmap_temporal_peak(inst_id)

DESCRIPTION ^

 Search temporal peak of cortical current timecourse
 
 --- Syntax
 job_plot_cmap_temporal_peak(inst_id)

 --- History
 ????-??-?? Taku Yoshioka
 2008-09-01 Taku Yoshioka
 2008-10-24 Taku Yoshioka
 2010-12-01 taku-y
  [internal change] 'Jinfo' replaces 'MEGinfo'.
 2010-12-06 taku-y
  [enhancement] Jinfo.version>=0.9 supported. 
 2010-12-08 taku-y
  [internal change] vb_version_cmp used.
 2012-01-26 sako
  [minor change] n_trial -> "n_trial" was replaced to "ix_trial"

 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_cmap_temporal_peak(inst_id)
0002 % Search temporal peak of cortical current timecourse
0003 %
0004 % --- Syntax
0005 % job_plot_cmap_temporal_peak(inst_id)
0006 %
0007 % --- History
0008 % ????-??-?? Taku Yoshioka
0009 % 2008-09-01 Taku Yoshioka
0010 % 2008-10-24 Taku Yoshioka
0011 % 2010-12-01 taku-y
0012 %  [internal change] 'Jinfo' replaces 'MEGinfo'.
0013 % 2010-12-06 taku-y
0014 %  [enhancement] Jinfo.version>=0.9 supported.
0015 % 2010-12-08 taku-y
0016 %  [internal change] vb_version_cmp used.
0017 % 2012-01-26 sako
0018 %  [minor change] n_trial -> "n_trial" was replaced to "ix_trial"
0019 %
0020 % Copyright (C) 2011, ATR All Rights Reserved.
0021 % License : New BSD License(see VBMEG_LICENSE.txt)
0022 
0023 global vbmeg_inst; 
0024 if isempty(vbmeg_inst.plotcmap{inst_id}.V), return; end
0025 if isempty(vbmeg_inst.plotcmap{inst_id}.Jact), return; end
0026 
0027 %
0028 % Global variables
0029 %
0030 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0031 ix_trial = vbmeg_inst.plotcmap{inst_id}.ix_trial;
0032 toi      = vbmeg_inst.plotcmap{inst_id}.toi;
0033 ix_peak  = vbmeg_inst.plotcmap{inst_id}.ix_peak;
0034 Jinfo    = vbmeg_inst.plotcmap{inst_id}.Jinfo;
0035 h_fig    = vbmeg_inst.plotcmap{inst_id}.h_fig;
0036 ed7      = vbmeg_inst.plotcmap{inst_id}.ed7;
0037 
0038 if isempty(Jinfo), return; end
0039 
0040 set(h_fig,'Pointer','watch');
0041 drawnow;
0042 
0043 %
0044 % Calculate brain activity map
0045 %
0046 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0047 ixx = ix_peak;
0048 if ixx==0, 
0049   J = zeros(length(T),1); 
0050 else
0051   %tt = ceil([t(1) t(2)]*MEGinfo.SampleFreq/1000-Tstart ...
0052   %          +vb_meginfo_get_pre_trigger(MEGinfo))+1;
0053   %tt = ceil((t(1):t(2))*Jinfo.SampleFreq/1000-Tstart+Jinfo.Pretrigger)+1;
0054   %tt = tt(1):tt(2);
0055   if vb_version_cmp(Jinfo.version,'>=','0.9-0.a.0')
0056     tt(1) = ceil(toi(1)*Jinfo.SampleFreq/1000+Jinfo.Pretrigger);
0057     tt(2) = ceil(toi(2)*Jinfo.SampleFreq/1000+Jinfo.Pretrigger);
0058     tt = tt(1):tt(2);
0059   else
0060     Tstart  = vbmeg_inst.plotcmap{inst_id}.Tstart;
0061     tt = ceil((toi(1):toi(2))*Jinfo.SampleFreq/1000-Tstart ...
0062               +Jinfo.Pretrigger)+1;
0063   end;
0064   J = job_plot_cmap_get_current(inst_id,ix_trial,tt);
0065   J = vbmeg_inst.plotcmap{inst_id}.W(ixx,:)*abs(J); 
0066 end;
0067 
0068 %
0069 % Find temporal peak
0070 %
0071 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0072 [tmp,t_peak] = max(abs(J));
0073 t_peak = t_peak+tt(1)-1;
0074 %t_center = (1000/MEGinfo.SampleFreq)*...
0075 %           (Tstart+t_peak-vb_meginfo_get_pre_trigger(MEGinfo));
0076 if vb_version_cmp(Jinfo.version,'>=','0.9-0.a.0')
0077   t_center = (1000/Jinfo.SampleFreq)*(1+t_peak-Jinfo.Pretrigger);
0078 else
0079   t_center = (1000/Jinfo.SampleFreq)*(Tstart+t_peak-Jinfo.Pretrigger);
0080 end;
0081 
0082 %
0083 % Update time window
0084 %
0085 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0086 Tsize = str2num(get(ed7,'String'));
0087 if Tsize<0, 
0088   Tsize=10; 
0089   set(ed4,'Value','10');
0090 end
0091 vbmeg_inst.plotcmap{inst_id}.toi(1) = t_center-Tsize;
0092 vbmeg_inst.plotcmap{inst_id}.toi(2) = t_center+Tsize;
0093 
0094 %
0095 % Update figure
0096 %
0097 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0098 job_plot_cmap_update_timecourse(inst_id); 
0099 job_plot_cmap_update_spatialpattern(inst_id);
0100 
0101 set(h_fig,'Pointer','arrow');
0102 
0103 return;

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