Importing BCI2000 .dat files into EEGLab

Forum for software developers to discuss BCI2000 software development
Locked
Bgabin
Posts: 2
Joined: 21 Sep 2011, 00:06

Importing BCI2000 .dat files into EEGLab

Post by Bgabin » 05 Jul 2012, 16:28

I have been trying to find a command line method to import .dat files into EEGLab, and have been getting some very strange errors. The GUI based plug-in works fine, but when I try to load multiple .dat files at the same time with pop_loadBCI2000.m it loses 60% of my event flags. Has anybody else been having this problem? Is there a know fix for this? Is there some way to use BCI2000import.m from the command line? Does anybody have any suggestions?

Thanks in advance.

sumits
Posts: 18
Joined: 15 Nov 2011, 06:25

Re: Importing BCI2000 .dat files into EEGLab

Post by sumits » 02 Jul 2013, 05:47

I wanted to read .dat files into EEGLAB. Can you tell me how you have been able to do it using the GUI?

I tried using the option for read BCI2000 ASCII files, but that does not complete. I tried using Import Data-> From other formats using BIOSIG toolbox, but then all event information is lost.

The following is the read log:

Code: Select all

Pop_loadbci: importing BCI file...
eeg_checkset note: upper time limit (xmax) adjusted so (xmax-xmin)*srate+1 = number of frames
Reading data file header...
Warning SOPEN (BCI2000): HDR.EVENT.TYP information need to be extracted from HDR.BCI2000.STATE
Warning SOPEN: Automated OVERFLOWDETECTION not supported - check yourself for saturation artifacts.
Warning SOPEN (BCI2000): HDR.EVENT.TYP information need to be extracted from HDR.BCI2000.STATE
Reading data in BCI2000 format...
eeg_checkset note: upper time limit (xmax) adjusted so (xmax-xmin)*srate+1 = number of frames
Extracting events from last EEG channel...
Warning: event extraction failure, the last channel contains data
Warning: no event found. Events might be embeded in a data channel.
         To extract events, use menu File > Import Event Info > From data channel
Creating a new ALLEEG dataset 1
Done.
Any help would be appreciated.

Thanks
Sumit

boulay
Posts: 382
Joined: 25 Dec 2011, 21:14

Re: Importing BCI2000 .dat files into EEGLab

Post by boulay » 02 Jul 2013, 21:08

I've attached a file. Put it in
eeglab\plugins\bci2000import0.21\pop_loadBCI2000.m

Can you try it and tell me if it works for you? This should be the same as in the BCI2000 source (BCI2000/tools/EEGlabImport).

boulay
Posts: 382
Joined: 25 Dec 2011, 21:14

Re: Importing BCI2000 .dat files into EEGLab

Post by boulay » 02 Jul 2013, 21:12

Sorry, I should add more information.

eeglab comes with a BCI2000 import plugin already (not the ascii one, ignore that). From the EEGLAB menu you should have the option to
File>Import Data>Using EEGLAB functions and plugins>From BCI2000 .DAT file
(For some reason this is purple on my screen).

If you do not have that option, you can either download the eeglab source again, or you can download the BCI2000 source and copy the BCI2000\tools\EEGlabImport folder to eeglab\plugins\

That option should now be available to you.

The file attached in the previous e-mail is a replacement for the older one that comes with eeglab. I've made a few enhancements so it should be faster and work with more types of input.

sumits
Posts: 18
Joined: 15 Nov 2011, 06:25

Re: Importing BCI2000 .dat files into EEGLab

Post by sumits » 03 Jul 2013, 00:17

Hi,

Thanks for the help. I was unable to view the attachment that you had mentioned.

However, I copied the BCI2000\tools\EEGlabImport folder to eeglab\plugins\ and then tried to read a BCI2000 .dat file, but got the following error message:
EEGLAB Error
EEGLAB Error
I am using EEGLAB v10.2.2.4b and BCI2000 source from http://www.bci2000.org/svn/trunk.

boulay
Posts: 382
Joined: 25 Dec 2011, 21:14

Re: Importing BCI2000 .dat files into EEGLab

Post by boulay » 03 Jul 2013, 00:38

Either
1) make sure bci2000/tools/Mex is on your matlab path or
2) copy that folder's contents into the eeglab plugin folder you copied previously.

sumits
Posts: 18
Joined: 15 Nov 2011, 06:25

Re: Importing BCI2000 .dat files into EEGLab

Post by sumits » 09 Jul 2013, 03:06

I tried the steps mentioned, but the following error message is obtained.
Error message
Error message

boulay
Posts: 382
Joined: 25 Dec 2011, 21:14

Re: Importing BCI2000 .dat files into EEGLab

Post by boulay » 09 Jul 2013, 03:32

I need some more information.

1) What version of the plugin are you using? Open EEGLAB, then from the MATLAB command prompt run

Code: Select all

open pop_loadBCI2000
.
Do you see the 0.34 revision history comments around line 41? If not, then you're using an older version of the plugin than I am.

2) How many files are you trying to load at once?
There was an error with one of my revisions that had trouble loading a single file from the GUI, but that has since been fixed.
If you are loading more than 1 file, are you certain that the files are identical in structure? Do they have the same sample rate, same channel number, and same states?

3) In my version of pop_loadBCI2000.m, line 167 is

Code: Select all

EEG = eeg_checkset(EEG, 'eventconsistency');
. Is that what you have on that line? Probably not because I doubt that line would generate the error you posted. Please tell me what you have on line 167.

sumits
Posts: 18
Joined: 15 Nov 2011, 06:25

Re: Importing BCI2000 .dat files into EEGLab

Post by sumits » 09 Jul 2013, 04:39

Using EEGLAB v10.4.2.2b

These are lines 40-45.

Code: Select all

% Revision history:
%   0.30: Create boundary events when loading multiple files
%   0.26: Import channel labels
%   0.25: Added EEG.urevent structure
%   0.20: Adapted to EEGLAB conventions
%   0.10: Initial version
Trying to load only one file as of now.

Line 167 is :

Code: Select all

EEG.chanlocs(k).labels = parms.ChannelNames.Value{k}; end

boulay
Posts: 382
Joined: 25 Dec 2011, 21:14

Re: Importing BCI2000 .dat files into EEGLab

Post by boulay » 09 Jul 2013, 04:50

I sent you the newest version of pop_loadBCI2000.m. If you still have trouble then you might need newer versions of the load_bcidat mex files.

I use EEGLAB v12.0.2.2 but that shouldn't matter.

Locked

Who is online

Users browsing this forum: No registered users and 16 guests