Back to the main page.

Bug 2303 - reading generic EEG files fails due to error message from ft_senslabel

Reported 2013-09-27 00:06:00 +0200
Modified 2014-02-24 10:56:20 +0100
Product: FieldTrip
Component: fileio
Version: unspecified
Hardware: Macintosh
Operating System: Mac OS
Importance: P3 normal
Assigned to: Robert Oostenveld
Depends on:
See also:

Joseph Dien - 2013-09-27 00:06:48 +0200

ft_read_header calls on ft_chantype when there is no chantype field, which in turn when ft_senstype returns a positive for 'eeg' then calls on ft_senslabel to determine whether it matches 'eeg' which then fails since 'eeg' isn't on the list. I'm wondering if it was meant to be calling on 'electrode' instead, which is on the list? Or maybe 'eeg1010' or whatever? -----------ft_read_header------------------- if ~isfield(hdr, 'chantype') % use a helper function which has some built in intelligence hdr.chantype = ft_chantype(hdr); end % for ---------------ft_chantype--------------- elseif ft_senstype(input, 'eeg') && isheader % use an external helper function to define the list with EEG channel names type(match_str(hdr.label, ft_senslabel(ft_senstype(hdr)))) = {'eeg'}; --------------ft_senstype---------------- case 'electrode' % there is no default set of electrode labels for all possible EEG systems % but nevertheless the requested input type 'electrode' should not result in an error label = {}; otherwise error('the requested sensor type is not supported'); end ------------------------------ I'm testing with fieldtrip-20130923 on Matlab 2013b on OS X 10.8.5

Robert Oostenveld - 2013-09-27 08:33:54 +0200

I have to admit that the organization is kind of spaghetti code. Part of it is implemented to deal with chantype while reading, part of it is there to deal with it to "fix" old fieldtrip data structures that are read from *.mat files. It is mainly relevant for MEG data, where some functions need to behave differently depending on axial or planar gradiometers. I will have a look.

Robert Oostenveld - 2013-09-27 08:59:03 +0200

I prefer to use eeg as the description of the acquisition system (like ctf151) rather than electrode. It is an "eeg" system, not an "electrode" system. But there is code that already uses "electrode" which is hard to track. I changed ft_senslabel so thaht eeg and electrode are treated the same. mac001> svn commit ft_senslabel.m Sending ft_senslabel.m Transmitting file data . Committed revision 8556.

Robert Oostenveld - 2013-09-27 09:05:07 +0200

Use eeg instead of electrode, and meg instead of magnetometer: mac001> svn commit fileio/private/ft_senstype.m Sending fileio/private/ft_senstype.m Transmitting file data . Committed revision 8558.

Robert Oostenveld - 2013-09-27 09:19:20 +0200

I was not able to reproduce your error, but have made some changes to make the code more consistent. Could you try again?

Joseph Dien - 2013-10-01 15:22:15 +0200

The fix worked! :) I'm attaching a test case.

Joseph Dien - 2013-10-01 16:05:28 +0200

Created attachment 525 test case

Robert Oostenveld - 2013-10-01 17:45:20 +0200

(In reply to comment #6) thanks, I added a test script. mac001> svn commit test_bug2303.m Adding test_bug2303.m Transmitting file data . Committed revision 8581.

Robert Oostenveld - 2014-02-24 10:56:20 +0100

I closed several bugs at once that all have been resolved for some time. If you disagree, please reopen.