Biosemi data format/Reading .bdf into Matlab

Post Reply
RicardaBraukmann
Posts: 4
Joined: Tue Sep 23, 2014 10:08 am

Biosemi data format/Reading .bdf into Matlab

Post by RicardaBraukmann »

Hi everyone,

I am new to Biosemi and I have a couple of question regarding the Biosemi data format and reading in .bdf files into Matlab.
I would like to use Fieldtrip, a Matlab toolbox for EEG analysis (see http://fieldtrip.fcdonders.nl/), to analyze my data, but I am encountering some problems when trying to read in raw biosemi data (.bdf).

The main thing is that the data looks odd to me as the vertial scale is very large [ -178000 178000 ], but also filtering and trial selection does not work properly.

From what I have read so far about Biosemi, I suspect that this might have to do with the DC-offset and that I might have to re-reference the data. I tried this using one of the EXG channels ('EXG5'), but this did not help.
I am afraid that I dont fully understand Biosemi data and it would be great if someone could give me some more insights into this matter.

- Is this scaling problem indeed caused by the offset/Do I indeed need to re-reference the data before I can use it in Matlab?
- If so, what should be used as a reference?
- In addition, I was wondering if someone could explain to me what these EXG channels (there are 8 of those in my data) are exactly?


Since I wasn't able to work with the .bdf files, I tried to convert them to .edf (using the converter from http://www.biosemi.com/download/).
This .edf file looks much more normal in Fieldtrip, but the data is still very noisy and I still encounter some problems, especially when trying to filter the data. When applying a high-pass filter (0.5Hz) on the data for example, Matlab gives an error reporting unstable poles.

- I was not sure whether I need to re-reference this .edf file as well (which leads again to my question about re-referencing and the EXG channels)
- Any additional suggestions on why I might have problems with filtering are of course also very welcome!

In addition, I am curious what exactly happens to the data when it is converted from .bdf to .edf, so additional information on this would also be very much appreciated.

Many Thanks in advance!
Best,
Ricarda

Coen
Site Admin
Posts: 1124
Joined: Fri Mar 26, 2004 7:00 pm
Location: Amsterdam, Netherlands
Contact:

Re: Biosemi data format/Reading .bdf into Matlab

Post by Coen »

Large scale is due to offsets, y-scale values are probably still unscaled (probably 1 unit = 1 LSB = 1/32th uV)

Referencing is always necessary (see http://www.biosemi.com/faq/cms&drl.htm), you should be able to do this after importing the file in Fieldtrip.

EX channels are 8 extra channels with (usually) flat type electrodes, used for EOG, ECG, EMG or mastoid references

BDF --> EDF applies an (adjustable) high-pass, and converts from 24 to 16 bits with adjustable LSB value.

Best regards, Coen (BioSemi)

RicardaBraukmann
Posts: 4
Joined: Tue Sep 23, 2014 10:08 am

Re: Biosemi data format/Reading .bdf into Matlab

Post by RicardaBraukmann »

Dear Coen,

Thanks for the clarifications.

I have two other questions.

- First, I was wondering what re-reference you would suggest. Would it be best to re-reference to the average?

Then, I also experience some problems with the markers that are read into Matlab. The codes we send (also using Matlab) during the experiment, do not match the codes that I see back in my data after reading it in.

For example, we have send a 103 originally and after reading in, I see 65383 instead.
Do you have any idea what might be causing this and how it can be adjusted?

Thank you very much for your help!
Best,
Ricarda

Coen
Site Admin
Posts: 1124
Joined: Fri Mar 26, 2004 7:00 pm
Location: Amsterdam, Netherlands
Contact:

Re: Biosemi data format/Reading .bdf into Matlab

Post by Coen »

Reference choice depends on the sort of analysis you want to do. Typical reference choices are: average of all electrodes, a single electrode like Cz, or the average of 2 flat (EX) electrodes behind the ears (mastoid reference, virtual point in the center of the head).

There are 16 trigger lines (bits), see http://www.biosemi.com/faq/trigger_signals.htm. In "analog" display mode, ActiView displays the 16 separate bits as colored bars or dots. In "digital" display mode, ActiView displays the triggers as two separate bytes (trig 1-8 and trig 9-16). So you will two groups of numbers each in the 0-255 range. Your Matlab program apparently shows a single 16 bit number in the 0-65535 range. Split the 16 bit word in 2 bytes, and you will see the same values as in ActiView.

Best regards, Coen (BioSemi)

RicardaBraukmann
Posts: 4
Joined: Tue Sep 23, 2014 10:08 am

Re: Biosemi data format/Reading .bdf into Matlab

Post by RicardaBraukmann »

Thanks you very much for this fast clarification! This does solve my problem with the markers!

RicardaBraukmann
Posts: 4
Joined: Tue Sep 23, 2014 10:08 am

Re: Biosemi data format/Reading .bdf into Matlab

Post by RicardaBraukmann »

Hi again,

Sorry for the inconvenience, but I just have one final question about the scaling of the data and the use of the converter.
Matlab does not automatically detect the scale of the data of the raw .bdf file but I would want to have the data displayed in uV.

I am understanding it correctly that I can use the converter to rescale the data? So if I chose the EDF setting LSB value 1.0 uV (66mVpp range) does that then mean that the scale of the .edf data will be (1) uV?

Thanks a lot for the clarification!
Ricarda

Dritan
Posts: 2
Joined: Thu Aug 31, 2017 7:46 pm

Re: Biosemi data format/Reading .bdf into Matlab

Post by Dritan »

Coen wrote:
Wed Sep 24, 2014 12:06 pm
Split the 16 bit word in 2 bytes, and you will see the same values as in ActiView.

Best regards, Coen (BioSemi)
Hi Coen, how can we do that? Split the 16 bit word in 2 bytes of 8 bits?

Coen
Site Admin
Posts: 1124
Joined: Fri Mar 26, 2004 7:00 pm
Location: Amsterdam, Netherlands
Contact:

Re: Biosemi data format/Reading .bdf into Matlab

Post by Coen »


murdugan
Posts: 2
Joined: Thu Aug 26, 2021 2:31 pm

Re: Biosemi data format/Reading .bdf into Matlab

Post by murdugan »

I would also be interested in the answer to this question. Can I use the converter to get the units to uV scale? If so what would be the settings for that?


RicardaBraukmann wrote:
Wed Sep 24, 2014 6:00 pm
Hi again,

Sorry for the inconvenience, but I just have one final question about the scaling of the data and the use of the converter.
Matlab does not automatically detect the scale of the data of the raw .bdf file but I would want to have the data displayed in uV.

I am understanding it correctly that I can use the converter to rescale the data? So if I chose the EDF setting LSB value 1.0 uV (66mVpp range) does that then mean that the scale of the .edf data will be (1) uV?

Thanks a lot for the clarification!
Ricarda

Coen
Site Admin
Posts: 1124
Joined: Fri Mar 26, 2004 7:00 pm
Location: Amsterdam, Netherlands
Contact:

Re: Biosemi data format/Reading .bdf into Matlab

Post by Coen »

Use the digital and physical min/max values in the file header to scale the data, see https://www.biosemi.com/faq/file_format.htm . From the file header, you can conclude that the scaling for the EEG channels is LSB = 31.25 nV (1/32th uV)

Using the BDF --> EDF converter to rescale the data is possible, but not recommended because you convert 24 bit data to 16 bit (LSB is increased) and you will loose DC information (high pass is applied to compress the data to a 16 bit range).

Best regards, Coen (BioSemi)

Post Reply