📄 pop_reref.m
字号:
% pop_reref() - Convert an EEG dataset to average reference or to a% new common reference.%% Usage:% >> EEGOUT = pop_reref( EEG ); % pop up interactive window% >> EEGOUT = pop_reref( EEG, ref, 'key', 'val' ...);%% Graphical interface:% "Compute average reference" - [edit box] Checking this box is the same % as giving an empty value to the 'ref' command line parameter.% "Re-reference data to channel number" - [checkbox] Checking this option% automatically uncheck the first checkbox and allow to enter a% value in the edit box on the right of the checkbox. It does not% correspond to any command line input.% "Re-reference data to channel number" - [edit box] Enter the index of the % electrode for re-referencing in this box. Same as using the % 'ref' command line input.% "Include old reference channel" - [checkbox] When re-referencing the data,% checking this checkbox allow to generate data for the old % reference channel. The location for this channel might not% have been defined and can be specified using the following % textbox. Using this option is the same as setting the 'method'% option to 'withref'.% "Include old reference channel" - [edit boxes] use these edit boxes to specify % the old reference channel location. Same as using the 'refloc' % optional input. (note that if the channel location structure % contains one more channel that the data, the last channel is % considered to be the reference and the location for this channel% does not have to be specified here). %% Inputs:% EEG - input dataset% ref - reference: [] = average reference% X = new reference electrode number%% Optional inputs:% 'method' - ['standard'|'withref'] can be either 'standard' or 'withref' % to recompute the old reference potential. See also reref().% 'refloc' - [cell array] old common reference name polar location % (can also be included as the last channel of the EEG.chanlocs % struture). i.e. { 'cz' 0 0 }%% Inputs:% EEGOUT - output dataset%% Author: Arnaud Delorme, CNL / Salk Institute, 12 Nov 2002%% See also: reref(), eeglab()%123456789012345678901234567890123456789012345678901234567890123456789012% Copyright (C) 2002 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: pop_reref.m,v $% Revision 1.28 2004/05/14 23:58:23 arno% operator precedence%% Revision 1.27 2004/01/30 23:01:52 arno% update channel position only if refloc is set%% Revision 1.26 2003/11/05 16:24:17 arno% homogenous -> homogeneous%% Revision 1.25 2003/10/14 17:03:08 arno% vararg2str for optional arguments%% Revision 1.24 2003/09/08 22:54:12 arno% typo for refstate%% Revision 1.23 2003/07/31 17:10:05 arno% conversion to 3-D for the last channel%% Revision 1.22 2003/07/31 17:03:31 arno% empty last channel%% Revision 1.21 2003/07/30 18:03:59 arno% allowing empty channel location%% Revision 1.20 2003/07/28 17:53:39 arno% channel ref index%% Revision 1.19 2003/07/28 16:46:49 arno% remove redundancy%% Revision 1.18 2003/07/28 16:42:03 arno% text with scott%% Revision 1.17 2003/07/27 01:19:21 arno% debuging GUI call%% Revision 1.16 2003/07/27 01:09:30 arno% debuging%% Revision 1.15 2003/07/27 00:44:32 arno% brand new function for rereferencing%% Revision 1.14 2003/07/25 23:49:54 arno% change interface, warning messages ...%% Revision 1.13 2003/07/25 00:11:56 arno% allowing multiple references%% Revision 1.12 2003/07/25 00:10:51 arno% correct typo%% Revision 1.11 2003/07/02 01:06:00 arno% remove debug msg%% Revision 1.10 2003/07/02 01:05:34 arno% debug msg%% Revision 1.9 2003/06/11 00:06:16 arno% header message%% Revision 1.8 2003/02/17 02:53:22 arno% reformating text for new functionality in help2html%% Revision 1.7 2003/02/16 23:30:20 arno% adding GUI info%% Revision 1.6 2002/11/13 23:13:51 arno% gui mutual exclusion problem%% Revision 1.5 2002/11/13 23:04:40 arno% removing extra electrode in average ref%% Revision 1.4 2002/11/13 20:29:44 arno% debugging%% Revision 1.3 2002/11/13 19:22:23 arno% averef field -> ref field%% Revision 1.2 2002/11/12 23:23:37 arno% mode -> method keyword%% Revision 1.1 2002/11/12 19:08:34 arno% Initial revision%% Revision 1.1 2002/04/05 17:32:13 arno% Initial revision%function [EEG, com] = pop_reref( EEG, ref, varargin);com = '';if nargin < 1 help pop_reref; return;end; if isempty(EEG.data) error('Pop_reref: cannot process empty data');end;% gui inputs% ----------if nargin < 2 % find initial reference % ---------------------- options = { 'refstate', EEG.ref }; includeref = 0; % this is for the second gui if strcmpi(EEG.ref, 'common') if length(EEG.chanlocs) == EEG.nbchan+1 disp('Extra channel detected: using cahnnel as reference'); includeref = 1; options = { 'refstate', EEG.nbchan+1 }; else geometry = { [1] [1.8 1] [1.8 1] [1.8 1] [1] [3 1 1 1] [3 1 1 1] }; enable1 = fastif(strcmp(EEG.ref, 'averef'), 'on', 'off'); enable2 = fastif(strcmp(EEG.ref, 'averef'), 'off', 'on'); % build gui % --------- geometry = { [1] [1.7 1] [1] [1.7 0.7] [1.7 0.7] [1] [3 1 1 1] [3 1 1 1] [1]}; vertgeom = [ 1 1 1 1 1 1 1 1 4]; uilist = { { 'style' 'text' 'string' 'THIS SCREEN IS USED TO ENTER CURRENT REFERENCE AND WILL ONLY APPEAR ONCE' } ... { 'style' 'checkbox' 'tag' 'ave' 'value' 0 'string' 'Data are in average reference' ... 'callback' ... [ 'set(findobj(''parent'', gcbf, ''tag'', ''reref''), ''value'', ~get(gcbo, ''value''));' ... 'set(findobj(''parent'', gcbf, ''tag'', ''reref2''), ''value'', ~get(gcbo, ''value''), ''enable'', ''off'');' ... 'set(findobj(''parent'', gcbf, ''tag'', ''oldref''), ''enable'', fastif(get(gcbo, ''value''), ''off'', ''on''));' ... 'set(findobj(''parent'', gcbf, ''tag'', ''rerefstr''), ''enable'', fastif(get(gcbo, ''value''), ''off'', ''on''));' ] } ... { } ... { 'style' 'text' 'string' ' OR' } ... { 'style' 'checkbox' 'tag' 'reref' 'value' 1 'string' 'Data are referenced to one site (default)' ... 'callback' ... [ 'set(findobj(''parent'', gcbf, ''tag'', ''ave''), ''value'', ~get(gcbo, ''value''));' ... 'set(findobj(''parent'', gcbf, ''tag'', ''reref2''), ''value'', 0, ''enable'', fastif(get(gcbo, ''value''), ''on'', ''off''));' ... 'set(findobj(''parent'', gcbf, ''tag'', ''rerefstr''), ''enable'', fastif(get(gcbo, ''value''), ''on'', ''off''));' ] } ... { } ...
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -