[Eeglablist] Automatic channel rejection by script

Makoto Miyakoshi mmiyakoshi at ucsd.edu
Wed Jul 11 11:21:36 PDT 2018


Dear Sebastian,

I may not have perfect understanding of what you want to do and what you
want to solve.
Let me get back to your original question.

> during preprocessing of data from a 128 channel EGI Geodesic Sensor Net,
I want to automatically reject channels and save their indices so that I
can later interpolate the reject channels.

If you have a set of before and after the channel rejection, you can
interpolate the rejected channels as missing data. This can be done through
EEGLAB GUI, so you don't need to worry about your current problem anyway.

That being said, the channel index problem you are talking about, I don't
understand exact detail. But I understand that sometimes you want to use
channel labels (i.e., absolute information) rather than channel index
(i.e., relative information). The problem of using relative information is
that it is no longer valid when the length or order of the data are
changed. For this reason, I often use channels labels to ensure I do what I
want to do. Again I want to point you to
https://sccn.ucsd.edu/wiki/Makoto's_useful_EEGLAB_code#Event_types and
learn to obtain channel labels for performing channel rejection (EEGLAB
function accepts both channel indices and labels).

The site is currently down for unknown reason but it will be available
soon. I will also update the page since I learned how to use cellfun() for
this purpose.

Makoto

On Tue, Jul 10, 2018 at 1:02 AM Sebastian Sauppe <sauppe.s at gmail.com> wrote:

> Dear Makoto,
>
> thanks a lot for your reply. The problem w
> th just using the indices that pop_rejchan returns is that they do not
> match the indices in the EEG dataset because I exclude the EOG channels
> from pop_rejchan. (I want to keep them in in any case.) This means that E9
> is returned by pop_rejchan as having index 8 (because E8 was not
> considered), but in the EEG set it has index 9.
>
> The solution that I resorted to now is not very elegant but does the job.
> I make a copy of the returned bad electrodes and then map them to their
> correct indices in the EEG set by hard-coding it. I.e. what is returned as
> index 8 by pop_rejchan should be index 9 (electrode E9) in the set file
> (and later also matching indices to compensate for having E57 and E100 as
> reference electrodes).
>
> indelec_pre_ICA_original = indelec_pre_ICA;
>> indelec_pre_ICA(indelec_pre_ICA_original == 8) = 9; % E9
> indelec_pre_ICA(indelec_pre_ICA_original == 9) = 10; % E10
> indelec_pre_ICA(indelec_pre_ICA_original == 10) = 11; % E11
> indelec_pre_ICA(indelec_pre_ICA_original == 11) = 12; % E12
> indelec_pre_ICA(indelec_pre_ICA_original == 12) = 13; % E13
> indelec_pre_ICA(indelec_pre_ICA_original == 13) = 15; % E15
> indelec_pre_ICA(indelec_pre_ICA_original == 14) = 16; % E16
> indelec_pre_ICA(indelec_pre_ICA_original == 15) = 17; % E17
> ...
>
> That is not very satisfying to hard-code it like this, though.
>
> Regards,
> Sebastian
>
> -----------
> Dr. Sebastian Sauppe
> Department of Comparative Linguistics, University of Zurich
> Homepage: https://sites.google.com/site/sauppes/
> Twitter: @SebastianSauppe <https://twitter.com/SebastianSauppe>
> Google Scholar Citations:
> https://scholar.google.de/citations?user=wEtciKQAAAAJ
> ResearchGate: http://www.researchgate.net/profile/Sebastian_Sauppe
> ORCID ID: http://orcid.org/0000-0001-8670-8197
>
> Am 10.07.2018 um 01:51 schrieb Makoto Miyakoshi <mmiyakoshi at ucsd.edu>:
>
> Dear Sebastian,
>
> > Is there a way to extract the actual indices of rejected channels so
> that in the later step the correct channels are interpolated?
>
> You have it, which is [1:7 9 10:13 15 16:20 22 23 24 26 27:122 127]
>
> > Can this somehow be done via the the electrode names rather their
> indices?
>
> You can obtain it as
>
> rejectedChannelLabels = {EEG.chanlocs([1:7 9 10:13 15 16:20 22 23 24 26
> 27:122 127]).labels}';
>
> For this kind of operation, see below. The wiki page is about how to deal
> with event types, but the same techniques can be used for EEG.chanlocs.
> https://sccn.ucsd.edu/wiki/Makoto's_useful_EEGLAB_code#Event_types
>
> Makoto
>
> On Mon, Jul 9, 2018 at 11:13 AM Sebastian Sauppe <sauppe.s at gmail.com>
> wrote:
>
>> Dear EEGLAB list members,
>>
>> during preprocessing of data from a 128 channel EGI Geodesic Sensor Net,
>> I want to automatically reject channels and save their indices so that I
>> can later interpolate the reject channels. However, I want to exclude EOG
>> channels from this step because I want to keep them for classifying ICs
>> later.
>>
>> When I run the command (excluding EOG channels)
>>
>> >> [EEG, indelec] = pop_rejchan(EEG, 'elec',[1:7 9 10:13 15 16:20 22 23
>> 24 26 27:122 127] ,'threshold',5,'norm','on','measure','kurt’);
>>
>> EEGLAB rejects 10 channels in my example data set and gives me their
>> indices. However, the indices are continuously counted excluding the EOGs
>> so that they don’t always reflect the channel indices in the actual
>> dataset. The EOGs are channels [E8 E14 E21 E25 E126 E126 E127 E128] and in
>> the list with rejected channels, for example E9 has index 8 because E8 was
>> not included, E15 has index 13 because E14 was not included etc.
>>
>> Is there a way to extract the actual indices of rejected channels so that
>> in the later step the correct channels are interpolated? Can this somehow
>> be done via the the electrode names rather their indices?
>>
>> Any hint is highly appreciated.
>>
>> Computing kurtosis for channels...
>> 10 electrodes labeled for rejection
>> # Elec. Measure
>> 1 E1 21.11 *Bad*
>> 2 E2 0.52
>> 3 E3 5.41 *Bad*
>> 4 E4 -1.22
>> 5 E5 -0.90
>> 6 E6 -0.70
>> 7 E7 -0.55
>> 8 E9 14.22 *Bad*
>> 9 E10 5.08 *Bad*
>> 10 E11 -1.37
>> 11 E12 -1.14
>> 12 E13 -1.17
>> 13 E15 2.08
>> 14 E16 2.31
>> 15 E17 2.96
>> 16 E18 4.43
>> 17 E19 1.90
>> 18 E20 2.88
>> 19 E22 2.19
>> 20 E23 3.88
>> 21 E24 8.80 *Bad*
>> 22 E26 -0.60
>> 23 E27 13.31 *Bad*
>> 24 E28 -1.03
>> 25 E29 0.45
>> 26 E30 -0.72
>> 27 E31 -0.86
>> 28 E32 4.64
>> 29 E33 -0.48
>> 30 E34 -0.51
>> 31 E35 -0.49
>> 32 E36 -0.44
>> 33 E37 -0.02
>> 34 E38 -1.36
>> 35 E39 -1.04
>> 36 E40 -1.05
>> 37 E41 -0.37
>> 38 E42 0.07
>> 39 E43 -0.65
>> 40 E44 -0.88
>> 41 E45 -0.73
>> 42 E46 -0.99
>> 43 E47 -0.36
>> 44 E48 5.79 *Bad*
>> 45 E49 -1.19
>> 46 E50 -1.09
>> 47 E51 -0.46
>> 48 E52 -0.14
>> 49 E53 -0.22
>> 50 E54 0.01
>> 51 E55 -0.21
>> 52 E56 -0.33
>> 53 E58 0.04
>> 54 E59 -0.18
>> 55 E60 -0.17
>> 56 E61 -0.22
>> 57 E62 -0.26
>> 58 E63 -1.17
>> 59 E64 -1.23
>> 60 E65 0.10
>> 61 E66 -0.71
>> 62 E67 -0.05
>> 63 E68 -0.91
>> 64 E69 0.09
>> 65 E70 -0.47
>> 66 E71 -0.20
>> 67 E72 -0.46
>> 68 E73 -0.15
>> 69 E74 0.67
>> 70 E75 -0.31
>> 71 E76 0.07
>> 72 E77 -0.31
>> 73 E78 0.07
>> 74 E79 -0.10
>> 75 E80 -0.21
>> 76 E81 1.45
>> 77 E82 3.49
>> 78 E83 -0.18
>> 79 E84 -0.38
>> 80 E85 0.10
>> 81 E86 0.25
>> 82 E87 -0.06
>> 83 E88 -0.90
>> 84 E89 0.09
>> 85 E90 0.16
>> 86 E91 0.11
>> 87 E92 0.16
>> 88 E93 -0.03
>> 89 E94 0.92
>> 90 E95 -0.41
>> 91 E96 0.31
>> 92 E97 0.13
>> 93 E98 0.12
>> 94 E99 -1.40
>> 95 E101 0.76
>> 96 E102 0.19
>> 97 E103 -0.18
>> 98 E104 18.00 *Bad*
>> 99 E105 -0.31
>> 100 E106 -0.37
>> 101 E107 -1.16
>> 102 E108 -0.46
>> 103 E109 -0.26
>> 104 E110 -1.24
>> 105 E111 -0.85
>> 106 E112 -0.72
>> 107 E113 -1.15
>> 108 E114 -0.68
>> 109 E115 0.00
>> 110 E116 -1.26
>> 111 E117 -1.00
>> 112 E118 0.52
>> 113 E119 44.10 *Bad*
>> 114 E120 0.75
>> 115 E121 34.52 *Bad*
>> 116 E122 1.97
>> 117 E123 -0.66
>> 118 E124 -1.34
>> 119 Cz -0.35
>> Removing 10 channel(s)...
>>
>> Regards,
>> Sebastian
>>
>> -----------
>> Dr. Sebastian Sauppe
>> Department of Comparative Linguistics, University of Zurich
>> Homepage: https://sites.google.com/site/sauppes/
>> Twitter: @SebastianSauppe <https://twitter.com/SebastianSauppe>
>> Google Scholar Citations:
>> https://scholar.google.de/citations?user=wEtciKQAAAAJ
>> ResearchGate: http://www.researchgate.net/profile/Sebastian_Sauppe
>> ORCID ID: http://orcid.org/0000-0001-8670-8197
>>
>> _______________________________________________
>> Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
>> To unsubscribe, send an empty email to
>> eeglablist-unsubscribe at sccn.ucsd.edu
>> For digest mode, send an email with the subject "set digest mime" to
>> eeglablist-request at sccn.ucsd.edu
>
>
>
> --
> Makoto Miyakoshi
> Swartz Center for Computational Neuroscience
> Institute for Neural Computation, University of California San Diego
>
>
>

-- 
Makoto Miyakoshi
Swartz Center for Computational Neuroscience
Institute for Neural Computation, University of California San Diego
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20180711/0f563fa8/attachment.html>


More information about the eeglablist mailing list