This repository has been archived by the owner on Jun 4, 2022. It is now read-only.
forked from sccn/amica
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheegplugin_amica.m
84 lines (75 loc) · 3.18 KB
/
eegplugin_amica.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
% eegplugin_amica() - AMICA plugin
%
% Usage:
% >> eegplugin_amica(fig, trystrs, catchstrs);
%
% Inputs:
% fig - [integer] eeglab figure.
% trystrs - [struct] "try" strings for menu callbacks.
% catchstrs - [struct] "catch" strings for menu callbacks.
%
% Notes:
% To create a new plugin, simply create a file beginning with "eegplugin_"
% and place it in your eeglab folder. It will then be automatically
% detected by eeglab. See also this source code internal comments.
% For eeglab to return errors and add the function's results to
% the eeglab history, menu callback must be nested into "try" and
% a "catch" strings. For more information on how to create eeglab
% plugins, see http://www.sccn.ucsd.edu/eeglab/contrib.html
%
% Author: Jason Palmer, SCCN, INC, UCSD
%
% See also: eeglab()
%123456789012345678901234567890123456789012345678901234567890123456789012
% Copyright (C) 2008, Jason Palmer
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program; if not, write to the Free Software
% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1.07 USA
% $Log: eegplugin_amica.m,v $
function vers = eegplugin_amica(fig, trystrs, catchstrs)
%global EEG
vers = 'amica1.5.1';
if nargin < 3
error('eegplugin_amica requires 3 arguments');
end;
% add amica folder to path
% -----------------------
if ~exist('runamica')
p = which('eegplugin_amica');
p = p(1:findstr(p,'eegplugin_amica.m')-1);
addpath(p);
end;
% find tools menu
% ---------------
menu = findobj(fig, 'tag', 'tools');
% tag can be
% 'import data' -> File > import data menu
% 'import epoch' -> File > import epoch menu
% 'import event' -> File > import event menu
% 'export' -> File > export
% 'tools' -> tools menu
% 'plot' -> plot menu
% menu callback commands
% ----------------------
comrun = [ 'pop_runica(EEG, ''selectamica'');' ];
comrunloc = [ 'pop_runica(EEG, ''selectamicaloc'');' ];
comload = [ trystrs.no_check 'EEG = pop_loadmodout(EEG);' catchstrs.store_and_hist ];
% create menus
% ------------
submenu = uimenu( menu, 'Label', 'Run AMICA', 'separator', 'on', 'CallBack', ...
'EEG = pop_runamica(EEG);[ALLEEG EEG CURRENTSET] = eeg_store(ALLEEG,EEG,CURRENTSET);eeglab redraw');
%submenu = uimenu( menu, 'Label', 'Run AMICA', 'separator', 'on');
%uimenu( submenu, 'Label', 'Run AMICA in parallel' , 'CallBack', comrun);
%uimenu( submenu, 'Label', 'Run AMICA locally' , 'CallBack', comrunloc);
%uimenu( submenu, 'Label', 'Load AMICA components' , 'CallBack', comload);