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, ['standard_' p.current_dirname, 's.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 = ['/home/cbi-data20/common/software/internal/vbmeg/vbmeg2_0_0_b_4/'...
0032 'standard_brain/mni_icbm152_t1_tal_nlin_asym_09c_10000/mni_icbm152_t1_tal_nlin_asym_09c_10000.brain.mat'];
0033 [V, F, xx, inf_C] = vb_load_cortex(brain_file, 'Inflate');
0034 plot_parm = vb_set_plot_parm;
0035
0036
0037 current_file = fullfile(p.proj_root, p.eeg_dirname, ['standard_' p.current_dirname, 's.curr.mat']);
0038 [~, current] = vb_load_current(current_file);
0039
0040
0041 y = mean(current(:, from_show:to_show, :), 3);
0042
0043
0044 [~, from_power] = min(abs(time-time_of_interest(1)));
0045 [~, to_power] = min(abs(time-time_of_interest(2)));
0046 ay=mean(abs(y(:,from_power:to_power)),2);
0047
0048
0049 h = figure;
0050 max_y = max(y(:));
0051 min_y = min(y(:));
0052 subplot(2, 1, 1)
0053 plot(time, y)
0054 xlabel('Time [s]')
0055 ylabel('Current [Am/m^2]')
0056 axis([time(1) time(end) min_y max_y])
0057
0058
0059 for an = 1:size(angle, 1)
0060 subplot(2, 2, 2+an)
0061 vb_plot_cortex(plot_parm, V, F, inf_C, ay, max(ay)*0.3, max(ay));
0062 axis equal off
0063 view(angle(an, :, 1))
0064
0065 if an==1
0066 title(['Absolute value of current (' num2str(time_of_interest(1)) ' - ' num2str(time_of_interest(2)) ' sec)'])
0067 end
0068 end
0069
0070
0071 vb_savefig_as_shown(h, fullfile(save_dir, 's'))
0072 end
0073
0074