-
Notifications
You must be signed in to change notification settings - Fork 27
/
eegplugin_limo.m
61 lines (54 loc) · 3 KB
/
eegplugin_limo.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
function version = eegplugin_limo(fig,try_strings,catch_strings)
% simple plugin function for eeglab
% call the LInear MOdeling of EEG data toolbox
% Multiple choices are available depending on the type
% of analysis
%
% Nicolas Chauveau,Cyril Pernet, Arnaud Delorme
% ---------------------------------------------
% Copyright (C) LIMO Team 2022
version ='limo4.0';
if nargin < 3
error('eegplugin_limo requires 3 arguments');
end
% add folder to path
% ------------------
if ~exist('pop_loadeep')
p = which('eegplugin_limo.m');
p = p(1:findstr(p,'eegplugin_limo.m')-1);
addpath( p );
addpath( fullfile(p, 'external') );
addpath( fullfile(p, 'external', 'psom') );
addpath( fullfile(p, 'limo_cluster_functions') );
addpath( fullfile(p, 'help') );
addpath( fullfile(p, 'deprecated') );
end
% create menus
% ------------
menu=findobj(fig,'tag','tools');
submenu = uimenu(menu, 'Label', version, 'separator', 'on', 'userdata','startup:on,study:on');
uimenu(submenu,'Label', 'GUI','callback','limo_eeg', 'userdata','study:on');
uimenu(submenu,'Label', '1st level analysis','callback','limo_batch', 'userdata','study:off');
uimenu(submenu,'Label', '2nd level analysis','callback','limo_random_effect','userdata','study:on,epoch:off,continuous:off');
uimenu(submenu,'Label', 'LIMO EEG results','callback','limo_results','userdata','study:on');
uimenu(submenu,'Label', 'LIMO EEG tools','callback','limo_tools','userdata','study:on');
% create STUDY menus for EEGLAB 15
% --------------------------------
[~,vnum] = eeg_getversion;
if isempty(vnum) || vnum >= 15
menu=findobj(fig,'tag','study');
onstudy = 'startup:off;epoch:off;continuous:off;study:on';
nocheck = 'try,';
e_catch = 'catch, eeglab_error; LASTCOM= ''''; clear EEGTMP ALLEEGTMP STUDYTMP; end;';
e_hist = [e_catch 'EEG = eegh(LASTCOM, EEG);'];
e_plot_study = [e_catch 'if ~isempty(LASTCOM), STUDY = STUDYTMP; STUDY = eegh(LASTCOM, STUDY); disp(''Done.''); end; clear ALLEEGTMP STUDYTMP; eeglab(''redraw'');']; % ALLEEG not modified
cb_limorunchan = [ nocheck '[STUDYTMP LASTCOM]= pop_limo(STUDY, ALLEEG,''dat'');' e_plot_study];
cb_limoruncomp = [ nocheck '[STUDYTMP LASTCOM]= pop_limo(STUDY, ALLEEG,''ica'');' e_plot_study];
% cb_limoreschan = [ nocheck 'pop_limoresults(STUDY,''dat'');' e_hist];
% cb_limorescomp = [ nocheck 'pop_limoresults(STUDY,''ica'');' e_hist];
limo_eeg = uimenu(menu,'Label','LInear MOdeling of EEG Data' , 'userdata', onstudy,'Tag','limoeeg','separator', 'on');
uimenu( limo_eeg, 'Label', 'Estimate Model Parameters (channel)' , 'userdata', onstudy, 'CallBack', cb_limorunchan);
uimenu( limo_eeg, 'Label', 'Estimate Model Parameters (components)' , 'userdata', onstudy, 'CallBack', cb_limoruncomp);
uimenu( limo_eeg, 'Label', '2nd level analysis','callback','limo_random_effect', 'userdata', onstudy,'separator', 'on');
uimenu( limo_eeg, 'Label', 'LIMO EEG results (1st and 2nd level)','callback','limo_results', 'userdata', onstudy);
end