📄 eegplugin_dipfit.m
字号:
% eegplugin_dipfit() - DIPFIT plugin version 1.0 for EEGLAB menu. % DIPFIT is the dipole fitting Matlab Toolbox of % Robert Oostenveld (in collaboration with A. Delorme).%% Usage:% >> eegplugin_dipfit(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: Arnaud Delorme, CNL / Salk Institute, 22 February 2003%% See also: eeglab()%123456789012345678901234567890123456789012345678901234567890123456789012% Copyright (C) 2003 Arnaud Delorme, Salk Institute, 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% $Log: eegplugin_dipfit.m,v $% Revision 1.26 2004/07/09 23:25:49 arno% dipfit version%% Revision 1.25 2004/07/09 22:10:24 arno% change dipfit revision number%% Revision 1.24 2003/12/05 01:16:48 arno% still version%% Revision 1.23 2003/12/05 01:08:58 arno% version%% Revision 1.22 2003/12/05 01:04:20 arno% revision number%% Revision 1.21 2003/12/04 01:42:25 arno% adding path%% Revision 1.20 2003/11/26 03:37:14 arno% add dipfit folder to path%% Revision 1.19 2003/11/25 19:20:33 arno% same%% Revision 1.18 2003/11/25 19:18:43 arno% conforming to smart plugin%% Revision 1.17 2003/11/17 20:08:10 arno% menu%% Revision 1.16 2003/11/05 16:21:21 arno% homogenous -> homogeneous%% Revision 1.15 2003/10/31 18:09:33 arno% sparator position%% Revision 1.14 2003/10/31 18:08:32 arno% menus%% Revision 1.13 2003/10/29 16:33:31 arno% manual fitting%% Revision 1.12 2003/10/11 01:53:36 arno% *** empty log message ***%% Revision 1.11 2003/10/11 01:52:51 arno% *** empty log message ***%% Revision 1.10 2003/10/11 01:51:48 arno% *** empty log message ***%% Revision 1.9 2003/10/11 01:51:05 arno% same%% Revision 1.8 2003/10/11 01:50:26 arno% update% menu%% Revision 1.7 2003/10/11 01:22:05 arno% adding automatic fitting menu%% Revision 1.6 2003/10/09 18:20:22 arno% update munu for grid%% Revision 1.5 2003/06/13 16:53:13 arno% checking electrodes%% Revision 1.4 2003/03/12 00:44:04 arno% adding menu for plotting components%% Revision 1.3 2003/02/26 16:23:03 arno% menu correction%% Revision 1.2 2003/02/24 22:32:50 arno% updating menus%% Revision 1.1 2003/02/24 19:53:26 arno% Initial revision%function vers = eegplugin_dipfit(fig, trystrs, catchstrs) vers = 'dipfit1.01'; if nargin < 3 error('eegplugin_dipfit requires 3 arguments'); end; % add dipfit folder to path % ----------------------- if ~exist('pop_dipfit_manual') p = which('eegplugin_dipfit'); p = p(1:findstr(p,'eegplugin_dipfit.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 % command to check that the '.source' is present in the EEG structure % ------------------------------------------------------------------- check_dipfit = ['if ~isfield(EEG, ''dipfit''), error(''Run the dipole setting first''); end;' ... trystrs.no_check ]; check_dipfitnocheck = ['if ~isfield(EEG, ''dipfit''), error(''Run the dipole setting first''); end; ' ... 'h(''% no history for manual DIPFIT dipole localization'');' ... trystrs.no_check ]; check_chans = [ '[EEG tmpres] = eeg_checkset(EEG, ''chanlocs_homogeneous'');' ... 'if ~isempty(tmpres), h(tmpres), end; clear tmpres;' ]; % menu callback commands % ---------------------- comauto = [ trystrs.check_ica check_chans '[EEG LASTCOM] = pop_multifit(EEG);' catchstrs.store_and_hist ]; comsetting = [ trystrs.check_ica check_chans '[EEG LASTCOM]=pop_dipfit_settings(EEG);' catchstrs.store_and_hist ]; combatch = [ check_dipfit check_chans '[EEG LASTCOM] = pop_dipfit_batch(EEG);' catchstrs.store_and_hist ]; comfit = [ check_dipfitnocheck check_chans 'EEG = pop_dipfit_manual(EEG);' catchstrs.store_and_hist ]; complot = [ check_dipfit check_chans 'LASTCOM = pop_dipplot(EEG);' catchstrs.add_to_hist ]; % create menus % ------------ submenu = uimenu( menu, 'Label', 'Locate dipoles using DIPFIT'); uimenu( submenu, 'Label', 'Autofit components' , 'CallBack', comauto); uimenu( submenu, 'Label', 'Head model and settings' , 'CallBack', comsetting, 'separator', 'on'); uimenu( submenu, 'Label', 'Coarse fit (grid scan)' , 'CallBack', combatch); uimenu( submenu, 'Label', 'Fine fit (iterative)' , 'CallBack', comfit); uimenu( submenu, 'Label', 'Plot component dipoles' , 'CallBack', complot, 'separator', 'on');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -