Back to the main page.

Bug 1567 - improve the detection of BrainVision *.dat files

Status CLOSED FIXED
Reported 2012-06-28 10:50:00 +0200
Modified 2015-07-15 13:21:08 +0200
Product: FieldTrip
Component: fileio
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P3 normal
Assigned to: Jim Herring
URL:
Tags:
Depends on:
Blocks:
See also:

Robert Oostenveld - 2012-06-28 10:50:27 +0200

this was a problem encountered at the workshop in Krakow. Some people have *.vhdr, *.vmrk and *.dat, and specify the dat file as cfg.dataset. FieldTrip then cannot autodetect the format. If they specify the vhdr the detection is fine. Usually at the DCCN the *.vhdr and *.vmrk files are complemented with a *.eeg file or with a *.seg file. Either one of the three should work -> just check for the presence of the triplet. TODO make test case with three examples test01.vhdr test01.vmrk test01.dat test01.vhdr test01.vmrk test01.seg test01.vhdr test01.vmrk test01.eeg and ensure that either one of these files is autodetected properly. Also see the dataset2files function (which is a.o. used in ft_checkconfig to assign the datafile and headerfile given the dataset).


Jörn M. Horschig - 2013-03-20 15:17:50 +0100

upon having fixed this, please adapt http://fieldtrip.fcdonders.nl/getting_started/brainvision appropriately


Jim Herring - 2014-01-08 16:42:10 +0100

The bug seems to be solved at the moment, I will create a test-script on the three types of file formats.


Jim Herring - 2014-01-09 11:04:39 +0100

I've added a test-script for this bug that attempts to load data from all the test cases mentioned above. It currently fails on two accounts: 1. if cfg.dataset is set with a marker-file (*.vmrk). This appears to fail becuase dataset2files does not have a case to handle 'brainvision-vmrk' file formats. However, do we intend to allow users to specify a marker file as a dataset? We currently allow and support to specify the data itself and the headerfile. 2. if cfg.dataset is set with a .dat file that has an ascii data format and is vectorized. This appears to fail in read_brainvision_vhdr.m at line 88: fid = fopen(hdr.DataFile, 'rt'); fopen cannot open the file because hdr.DataFile only contains the filename, not the full location. fopen therefore cannot find the file.


Robert Oostenveld - 2014-01-09 16:56:53 +0100

(In reply to Jim Herring from comment #3) I would not worry about case "1". It has never been an issue, people seem to be happy specifying the vhdr or eeg/dat file as dataset name. I consider your item "2" is a user error. If you specify the name of a file without path, and that file is not in the pwd, reading fails for all file formats (not only brainvision).


Jim Herring - 2014-01-09 17:26:41 +0100

Sorry, I just realised I was not clear enough about problem 2. Problem 2 also occurs if you specify a full path in cfg.dataset because fopen in read_brainvision_vhdr uses hdr.DataFile, which appears to only contain the filename (not full file path).


Robert Oostenveld - 2014-01-09 19:31:28 +0100

(In reply to Jim Herring from comment #5) ah, that makes more sense. Yes, that can be considered as a bug.


Jim Herring - 2014-01-13 12:43:49 +0100

One of the two cases within the same if-statement was already adding the full path to the filename so I moved that line of code outside of the if-statement so it can by used by both cases. The bug is thereby fixed. Sending fileio/private/read_brainvision_vhdr.m Sending test/test_bug1567.m Transmitting file data .. Committed revision 9094.


Jim Herring - 2014-01-15 15:15:09 +0100

Problem should be fixed now.