2 % IDENTIFY_EOG_CHANNELS returns bipolar EOG channels
for
3 % correcting of EOG artifacts
using regression analysis
5 % EOGchan = IDENTIFY_EOG_CHANNELS(...)
7 % EOGchan is a sparse matrix of size number_of_channels x 2.
8 % The sparsity ensures that missing samples of unrelated channels
9 %
do not affect the data.
11 % [...] = IDENTIFY_EOG_CHANNELS(filename)
12 % [...] = IDENTIFY_EOG_CHANNELS(HDR)
13 % filename or HDR
struct can be used
14 % [...] = IDENTIFY_EOG_CHANNELS(...,
'x')
15 % looks
for EOG channels whos Label start with x
17 % see also: GET_REGRESS_EOG, SLOAD
20 % [1] Schlogl A, Keinrath C, Zimmermann D, Scherer R, Leeb R, Pfurtscheller G.
21 % A fully automated correction method of EOG artifacts in EEG recordings.
22 % Clin Neurophysiol. 2007 Jan;118(1):98-104. Epub 2006 Nov 7.
27 % Copyright (C) 2006,2007,2009,2010 by Alois Schloegl
28 % This is part of the BIOSIG-toolbox http:
30 % Biosig is free software; you can redistribute it and/or
31 % modify it under the terms of the GNU Library General Public
32 % License as published by the Free Software Foundation; either
33 % Version 3 of the License, or (at your option) any later version.
35 % This library is distributed in the hope that it will be useful,
36 % but WITHOUT ANY WARRANTY; without even the implied warranty of
37 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
38 % Library General Public License
for more details.
40 % You should have received a copy of the GNU Library General Public
41 % License along with
this library;
if not, write to the
42 % Free Software Foundation, Inc., 59 Temple Place - Suite 330,
43 % Boston, MA 02111-1307, USA.
54 g1 = strmatch(
'EOG-left',HDR.Label);
55 g2 = strmatch(
'EOG-central',HDR.Label);
56 g3 = strmatch(
'EOG-right',HDR.Label);
57 if isempty([g1,g2,g3])
58 g1 = strmatch(
'EOG:ch01',HDR.Label);
59 g2 = strmatch(
'EOG:ch02',HDR.Label);
60 g3 = strmatch(
'EOG:ch03',HDR.Label);
65 v1 = strmatch(
'eogv1',lower(HDR.Label));
66 v2 = strmatch(
'eogv2',lower(HDR.Label));
67 v0 = strmatch(
'eogv',lower(HDR.Label));
68 v3 = strmatch(
'eogvp',lower(HDR.Label));
69 v4 = strmatch(
'eogvn',lower(HDR.Label));
71 h1 = strmatch(
'eogh1',lower(HDR.Label));
72 h2 = strmatch(
'eogh2',lower(HDR.Label));
73 h0 = strmatch(
'eogh' ,lower(HDR.Label));
74 h3 = strmatch(
'eoghp',lower(HDR.Label));
75 h4 = strmatch(
'eoghn',lower(HDR.Label));
80 v3 = strmatch(
'xeogvp',lower(HDR.Label));
81 v4 = strmatch(
'xeogvn',lower(HDR.Label));
86 h3 = strmatch(
'xeoghp',lower(HDR.Label));
87 h4 = strmatch(
'xeoghn',lower(HDR.Label));
92 if isempty(v), v=v0; end;
94 if isempty(h), h=h0; end;
96 chEOG = sparse([g1,g2,g2,g3],[1,1,2,2],[1,-1,1,-1],HDR.NS,2);
98 chEOG = sparse([g1,g2,g3],[1,1],[1,-1],HDR.NS,1);
101 sz2 = (length(v)>0) + (length(h)>0);
103 chEOG = sparse(v,c,1,HDR.NS,sz2);
105 chEOG = sparse(v,[c,c],[1,-1],HDR.NS,sz2);
110 chEOG = chEOG+sparse(h,1+c,1,HDR.NS,1+c);
112 chEOG = chEOG+sparse(h,[1,1]+c,[1,-1],HDR.NS,1+c);
117 warning(
'EOG channels are missing, or were not recognized');