0001 function show_source_current_eeg(p)
0002
0003
0004
0005
0006
0007 disp(mfilename);
0008
0009
0010 time_to_show = [-0.1 0.4];
0011 time_of_interest = [0 0.24];
0012 angle(:,:,1) = [-90 0;90 0];
0013 angle(:,:,2) = [-90 0;90 0];
0014 angle(:,:,3) = [-50 0;50 0];
0015
0016
0017 save_dir = fullfile(p.fig_root, mfilename, p.sub);
0018 if exist(save_dir, 'dir') ~= 7
0019 vb_mkdir(save_dir);
0020 end
0021
0022
0023 current_file = fullfile(p.proj_root, p.eeg_dirname, p.current_dirname, [p.task_list{1} '.curr.mat']);
0024 Jinfo = vb_load_current(current_file);
0025 time = Jinfo.Tmsec/1000;
0026 [~, from_show] = min(abs(time-time_to_show(1)));
0027 [~, to_show] = min(abs(time-time_to_show(2)));
0028 time = time(from_show: to_show);
0029
0030
0031 brain_file = fullfile(p.proj_root, p.brain_dirname, [p.struct_name, '.brain.mat']);
0032 [V, F, xx, inf_C] = vb_load_cortex(brain_file, 'Inflate');
0033 plot_parm = vb_set_plot_parm;
0034
0035 for ta = 1:length(p.task_list)
0036
0037
0038 current_file = fullfile(p.proj_root, p.eeg_dirname, p.current_dirname, [p.task_list{ta} '.curr.mat']);
0039 [~, current] = vb_load_current(current_file);
0040
0041
0042 y = mean(current(:, from_show:to_show, :), 3);
0043
0044
0045 [~, from_power] = min(abs(time-time_of_interest(1)));
0046 [~, to_power] = min(abs(time-time_of_interest(2)));
0047 ay=mean(abs(y(:,from_power:to_power)),2);
0048
0049
0050 h = figure;
0051 max_y = max(y(:));
0052 min_y = min(y(:));
0053 subplot(2, 1, 1)
0054 plot(time, y)
0055 xlabel('Time [s]')
0056 ylabel('Current [Am/m^2]')
0057 axis([time(1) time(end) min_y max_y])
0058
0059
0060 for an = 1:size(angle, 1)
0061 subplot(2, 2, 2+an)
0062 vb_plot_cortex(plot_parm, V, F, inf_C, ay, max(ay)*0.3, max(ay));
0063 axis equal off
0064 view(angle(an, :, ta))
0065
0066 if an==1
0067 title(['Absolute value of current (' num2str(time_of_interest(1)) ' - ' num2str(time_of_interest(2)) ' sec)'])
0068 end
0069 end
0070
0071
0072 vb_savefig_as_shown(h, fullfile(save_dir, p.task_list{ta}))
0073 end
0074
0075