[Eeglablist] Bug in EEG channel selection during import using pop_loadbv.m?
Tobias Overath
otobias at web.de
Wed Nov 28 06:46:30 PST 2018
Hi Andreas,
Thanks a lot for your reply. This all makes sense.
Best,
Tobias
> On Nov 20, 2018, at 11:48, Andreas Widmann <widmann at UNI-LEIPZIG.DE> wrote:
>
> Hi Tobias,
>
> this option is indeed not intended to sort or duplicate channels but only to select channel subsets (actually only to save some RAM). The suggested change would considerably slow down reading speed (by about factor 8 here, 40 vs. 5 secs) if reading the whole file. Seeking in a file is a slow operation. With sufficient RAM it is considerably faster to import the whole file and then delete some channels.
>
> What you want to achieve could be done in two lines on the CLI or as two re-referencing operations in the GUI (first re-referencing to any channel including the "Add current reference back to the data" option and then re-referencing to average mastoids as you do anyway).
>
> Best,
> Andreas
>
>> Am 20.11.2018 um 03:50 schrieb Tobias Overath <otobias at web.de>:
>>
>> Hi,
>>
>> I believe I have detected a bug in pop_loadbv.m, lines 197-206, where, if the number of channels selected to import is the same as the original number of channels, EEGLAB just imports all original channels, even if the specified channels do not request that.
>> In our specific example we have a 63-channel EEG montage and an Aux channel, so a total of 64 channels. We are referencing to the right mastoid (channel 32), but during import we specify to import the following channels: [1:31 31 32:63]. We do this so that we can then set the second channel ’31' to zero and re-reference the data to the average mastoids. However, in this case the channel vector length is the same (64) as the original number of channels (64), and the
>> if EEG.nbchan == hdr.commoninfos.numberofchannels
>> statement is true, so it will just import all original channels (including the Aux channel).
>>
>> My temporary fix is to comment out lines 197-200 and line 206, so that lines 196-206 of pop_loadbv.m now read:
>> case 'multiplexed'
>> % if EEG.nbchan == hdr.commoninfos.numberofchannels % Read all channels
>> % fseek(IN, (srange(1) - 1) * EEG.nbchan * bps, 'bof');
>> % EEG.data = fread(IN, [EEG.nbchan, EEG.pnts], [binformat '=>float32']);
>> % else % Read channel subset
>> EEG.data = repmat(single(0), [EEG.nbchan, EEG.pnts]); % Preallocate memory
>> for chan = 1:length(chans)
>> fseek(IN, (srange(1) - 1) * hdr.commoninfos.numberofchannels * bps + (chans(chan) - 1) * bps, 'bof');
>> EEG.data(chan, :) = fread(IN, [1, EEG.pnts], [binformat '=>float32'], (hdr.commoninfos.numberofchannels - 1) * bps);
>> end
>> % end
>>
>>
>> Please let me know if I am making a mistake here.
>>
>> Best,
>>
>> Tobias
>> _______________________________________________
>> 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
>
More information about the eeglablist
mailing list