Trouble with repairing BDF file

Post Reply
Nathan5653
Posts: 6
Joined: Sat Aug 19, 2023 4:20 pm

Trouble with repairing BDF file

Post by Nathan5653 »

Hi all,

I am having an issue loading two BDF files into MNE-Python, which I suspect to be an issue with the header. Based on reading some of the threads here, I tried to use ActiTools to repair the BDF files. For the first one says 'Completed successfully' but the fields remain blank and the resulting repaired BDF is only 1kb in size, compared with the original 1gb. The second one shows -1 in some of the fields and the repaired file is also only 1kb in size. Does anyone know what is going on? I've included screenshots.

Thanks,
Nathan
Attachments
EEGRepair2.jpg
EEGRepair2.jpg (112.95 KiB) Viewed 11429 times
EEGRepair1.jpg
EEGRepair1.jpg (116.44 KiB) Viewed 11429 times

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

Re: Trouble with repairing BDF file

Post by Coen »

It looks like most of the header is zero. It is unlikely that this is a BDF file generated by ActiView. Which error message does ActiRead display ?

Best regards, Coen (BioSemi)

Nathan5653
Posts: 6
Joined: Sat Aug 19, 2023 4:20 pm

Re: Trouble with repairing BDF file

Post by Nathan5653 »

Hi Coen,

Thank you for the quick reply. I've attached the error message. It is definitely from ActiView, though, because I have 30 other BDF files also collected with ActiView, with the same configuration and setup, and I haven't experienced any issue processing them through MNE.

Thanks,
Nathan
Attachments
ActiRead_Error.jpg
ActiRead_Error.jpg (39.59 KiB) Viewed 11374 times

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

Re: Trouble with repairing BDF file

Post by Coen »

The first bytes of the header are already corrupted, and it looks like a lot of fields have been overwritten with zero's. We have only seen things like that when a computer crashes during recording (although usually in such cases only the file length field is wrong and can be easily repaired).

Please sent the 2 corrupted files and 1 good file to info@biosemi.com via WeTransfer. We will inspect the headers and report. Provided that the 3 files were recorded with same configuration (number of channels, sample rate), then there is a small change that we can repair the corrupted files by replacing the corrupted headers by a good header.

Best regards, Coen (BioSemi)

Nathan5653
Posts: 6
Joined: Sat Aug 19, 2023 4:20 pm

Re: Trouble with repairing BDF file

Post by Nathan5653 »

Hi Coen,

Thank you so much, I have sent the email now.

Thanks,
Nathan

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

Re: Trouble with repairing BDF file

Post by Coen »

It appeared that the header and part of the data at the beginning of the file were missing (we have no idea how the file could get corrupted like this, we have never seen anything similar). We could repair the file by stripping the begin of the file until the start of a whole 1 sec data block, adding the header of the good file, and finally correcting the file length in the header with the "repairer" tool. I have send the recovered file with WeTransfer.

Best regards, Coen (BioSemi)

Nathan5653
Posts: 6
Joined: Sat Aug 19, 2023 4:20 pm

Re: Trouble with repairing BDF file

Post by Nathan5653 »

Hi Coen,

Thank you so much; I couldn't load the BDF file on MNE before but it can be loaded now. However, there now seems to be an issue with the trigger codes. I always record in decimal mode with the trigger codes 251 (525 trials), 252 (525 trials), 253 (525 trials), and 53 (100 trials) for a total of 1675 trials. However, when I tried to epoch the events using the trigger codes, MNE said that it detected 795485 events with wildly different event IDs. I've looked around in some of the other threads but I haven't been able to find a solution (is this question more suitable for the MNE forums?) I've attached a screenshot of the new trigger values.

Thanks,
Nathan
Attachments
Events.jpg
Events.jpg (221.62 KiB) Viewed 11263 times

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

Re: Trouble with repairing BDF file

Post by Coen »

We have inspected the file, all the data (not just the triggers) is corrupted after 1960 seconds (total file is 4576 sec). In an Hex-file-editor, we can see that after 1960 seconds the data is from an Excel file. It looks like hard disk problems, but how this could happen without error popups is puzzling. I am afraid that we cannot recover anything more.

You can limit the file to the first 1960 seconds with the "Cropper" tool.

Best regards, Coen (BioSemi)

Nathan5653
Posts: 6
Joined: Sat Aug 19, 2023 4:20 pm

Re: Trouble with repairing BDF file

Post by Nathan5653 »

Hi Coen,

I see. That's unfortunate. But thank you very much again for taking the time to deal with my issue, I really appreciate it!

Nathan

Post Reply