-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheegplugin_loreta.m
74 lines (66 loc) · 2.98 KB
/
eegplugin_loreta.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
% eegplugin_loreta() - EEGLAB plugin for exporting/importing component
% scalp maps to LORETA.
% Usage:
% >> eegplugin_loreta(fig);
% >> eegplugin_loreta(fig, trystrs, catchstrs);
%
% Inputs:
% fig - [integer] EEGLAB figure
% trystrs - [struct] "try" strings for menu callbacks. See notes.
% catchstrs - [struct] "catch" strings for menu callbacks. See notes.
%
% Author: Arnaud Delorme, SCCN, INC, UCSD, 2005
%
% See also: eeglab()
% Copyright (C) 2005 Arnaud Delorme, SCCN, INC, UCSD, 2005 arno@salk.edu
%
% 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-1307 USA
function vers = eegplugin_loreta(fig, trystrs, catchstrs)
vers = 'loreta2.0';
if nargin < 3
error('eegplugin_loreta requires 3 arguments');
end;
% add loreta folder to path
% -----------------------
if ~exist('loreta_importcomp')
p = which('eegplugin_loreta');
p = p(1:findstr(p,'eegplugin_loreta.m')-1);
addpath([ p vers ] );
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
% ----------------------
catchstrs.store_and_hist = [ ...
'[ALLEEG EEG] = eeg_store(ALLEEG, EEG, CURRENTSET); ' ...
'catch, errordlg2(lasterr, ''EEGLAB error''); LASTCOM= ''''; clear EEGTMP; end;' ...
'h(LASTCOM); disp(''Done.''); eeglab(''redraw'');' ];
comexport = [ trystrs.check_data 'pop_eeglab2loreta(EEG);' catchstrs.add_to_hist ];
%comimport = [ trystrs.check_ica 'EEG = loretaimport(EEG);' catchstrs.store_and_hist ];
%complot1 = [ check_loreta 'pop_dipplot(EEG);' catchstrs.add_to_hist ];
% create menus
% ------------
submenu = uimenu( menu, 'Label', 'Locate dipoles using LORETA');
uimenu( submenu, 'Label', 'Export components to LORETA' , 'CallBack', comexport);
%uimenu( submenu, 'Label', 'Import dipoles from LORETA' , 'CallBack', '', 'enable', 'off');
%uimenu( submenu, 'Label', 'Plot dipoles on LORETA head' , 'CallBack', '', 'enable', 'off');