Back to the main page.
Bug 2170 - ft_read_event changed for neuromag
Status | CLOSED FIXED |
Reported | 2013-05-15 10:02:00 +0200 |
Modified | 2015-01-26 12:46:49 +0100 |
Product: | FieldTrip |
Component: | fileio |
Version: | unspecified |
Hardware: | PC |
Operating System: | Mac OS |
Importance: | P3 normal |
Assigned to: | Robert Oostenveld |
URL: | |
Tags: | |
Depends on: | |
Blocks: | |
See also: |
Burkhard Maess - 2013-05-15 10:02:04 +0200
The reading of events has changed for neuromag files. Previously it was: eventtype: 'STI101' eventvalues: the non-zero values in channel STI101 now it is so that the former eventvalues show up as eventtype and the eventvalues are all set zero. Is this intended? Previously, one could deliver a list of wanted eventvalues. But now one would wish to deliver a list of eventtypes, which is not accepted.
Burkhard Maess - 2013-05-15 10:46:56 +0200
cfg = []; cfg.dataset=filename; cfg.trialdef.eventtype = '?'; cfg = ft_definetrial(cfg); % results in this output evaluating trialfunction 'ft_trialfun_general' 306 MEG channel locations transformed Opening raw data file /scr/nobel1/Sara/arnold/an05a/an05a4_ss.fif... Range : 16000 ... 442999 = 16.000 ... 442.999 secs Ready. reading the events from '/scr/nobel1/Sara/arnold/an05a/an05a4_ss.fif' the following events were found in the datafile event type: '0' with event values: 0 event type: '1' with event values: 0 event type: '20' with event values: 0 event type: '200' with event values: 0 event type: '201' with event values: 0 event type: '202' with event values: 0 event type: '203' with event values: 0 event type: '204' with event values: 0 no trials have been defined yet, see FT_DEFINETRIAL for further help found 122 events created 0 trials % problem is that the datatype is wrongly recognized >> cfg.dataformat ans = babysquid_fif >> cfg.headerformat ans = babysquid_fif % however, when providing the headerformat, the problem persists cfg = []; cfg.dataset=filename; cfg.dataformat='neuromag_mne'; cfg.headerformat='neuromag_mne'; cfg.trialdef.eventtype = '?'; cfg = ft_definetrial(cfg); % results in evaluating trialfunction 'ft_trialfun_general' 306 MEG channel locations transformed Opening raw data file /scr/nobel1/Sara/arnold/an05a/an05a4_ss.fif... Range : 16000 ... 442999 = 16.000 ... 442.999 secs Ready. reading the events from '/scr/nobel1/Sara/arnold/an05a/an05a4_ss.fif' the following events were found in the datafile event type: '0' with event values: 0 event type: '1' with event values: 0 event type: '20' with event values: 0 event type: '200' with event values: 0 event type: '201' with event values: 0 event type: '202' with event values: 0 event type: '203' with event values: 0 event type: '204' with event values: 0 no trials have been defined yet, see FT_DEFINETRIAL for further help found 122 events created 0 trials the call to "ft_definetrial" took 1 seconds and required the additional allocation of an estimated 1 MB
Robert Oostenveld - 2013-05-17 14:15:07 +0200
(In reply to comment #1) this then relates to the changes for http://bugzilla.fcdonders.nl/show_bug.cgi?id=1914 the babysquid system exports the data in fif format. However, some aspects are slightly different from the neuromag machines, hence the ability to specify babysquid_fif. I made a test script: roboos@mentat002> svn commit test_bug2170.m -m "enhancement - created initial test script for http://bugzilla.fcdonders.nl/show_bug.cgi?id=2170" Adding test_bug2170.m Transmitting file data . Committed revision 8130. The two test files both return neuromag_fif, so I cannot reproduce it yet. In ft_filetype there is around 277 % known BabySQUID file types, these should go before Neuromag elseif filetype_check_extension(filename, '.fif') && exist(fullfile(p, [f '.eve']), 'file') type = 'babysquid_fif'; manufacturer = 'Tristan Technologies'; content = 'MEG data'; elseif filetype_check_extension(filename, '.eve') && exist(fullfile(p, [f '.fif']), 'file') type = 'babysquid_eve'; manufacturer = 'Tristan Technologies'; content = 'MEG data'; % known Neuromag file types elseif filetype_check_extension(filename, '.fif') type = 'neuromag_fif'; manufacturer = 'Neuromag'; content = 'MEG header and data'; elseif filetype_check_extension(filename, '.bdip') type = 'neuromag_bdip'; manufacturer = 'Neuromag'; content = 'dipole model'; which suggests that you have an *.eve file. Can you confirm this? For me it is not clear whether the eve file is babysquid specific or whether it is something from neuromag in general. I have never heard a neuromag user about them.
Robert Oostenveld - 2013-05-17 14:19:39 +0200
(In reply to comment #1) the assignment of cfg.headerformat etc happens ft_checkconfig with the dataset2files option and uses ~/matlab/fieldtrip/fileio/private/dataset2files.m which is also present at ~/matlab/fieldtrip/private/dataset2files.m could you try ft_filetype('/scr/nobel1/Sara/arnold/an05a/an05a4_ss.fif') and post the result?
Burkhard Maess - 2013-05-21 10:15:19 +0200
of course, no problem >> ft_defaults >> ft_filetype('/scr/nobel1/Sara/arnold/an05a/an05a4_ss.fif') ans = babysquid_fif best, Burkhard
Robert Oostenveld - 2013-05-21 10:55:29 +0200
(In reply to comment #4) thanks. It means that you have an eve accompanying your fif. In ft_filetype around line 277 there is % known BabySQUID file types, these should go before Neuromag elseif filetype_check_extension(filename, '.fif') && exist(fullfile(p, [f '.eve']), 'file') type = 'babysquid_fif'; manufacturer = 'Tristan Technologies'; content = 'MEG data'; elseif filetype_check_extension(filename, '.eve') && exist(fullfile(p, [f '.fif']), 'file') type = 'babysquid_eve'; manufacturer = 'Tristan Technologies'; content = 'MEG data'; which is followed by the regular neuromag_fif detection. The consequence is that the eve file is read (in ft_read_event around line1087) rather than the continuously sampled trigger channels from the fif file. I suppose we should change the detection: the presence of an */eve is not enough evidence for it being data from the tristan babysquid system. I also suppose we should change the event reading: rather than 1) reading the trigger from the fif file in case of neuromag_fif 2) reading the *.eve file in case of babysquid_fif we should always combine 1 and 2, i.e. read it from both. Something similar happens for the CTF data format, which also represents "triggers/events" in the raw data file and potentially also in an extra marker file and in an extra class file. This requires the two to be merged in the event structure. Would you mind sharing your dataset with me for testing purposes?
Burkhard Maess - 2013-05-21 14:23:05 +0200
well, I do not mind - here it comes. ll an05a/an05a4_ss.* -rw-rw-r-- 1 maess neuro 3904 May 15 07:55 an05a/an05a4_ss.eve -rw-rw-rw- 1 megguest neuro 540969443 Dec 14 10:33 an05a/an05a4_ss.fif yes, indeed - I have a .eve file with the same name stored next to the fif-file. I have uploaded both files to dropbox: https://www.dropbox.com/s/jlv4hvkklio2lp1/an05a4_ss.bug2170.zip
Robert Oostenveld - 2013-05-21 15:13:18 +0200
(In reply to comment #6) I have copied it to my dropbox. You may now want to remove the files from yours, as bugzilla is open access and anyone reading your message could in principle download them. best Robert
Robert Oostenveld - 2013-12-02 10:34:59 +0100
consistently deal with neuromag fif and eve file, also used for Tristan BabySQUID datasets. See http://bugzilla.fcdonders.nl/show_bug.cgi?id=1914 and http://bugzilla.fcdonders.nl/show_bug.cgi?id=2170 mac001> svn commit ft_read_event.m ft_filetype.m private/ Sending ft_filetype.m Sending ft_read_event.m Deleting private/read_babysquid_eve.m Adding private/read_neuromag_eve.m Transmitting file data ... Committed revision 8930.
Robert Oostenveld - 2014-02-24 10:56:37 +0100
I closed several bugs at once that all have been resolved for some time. If you disagree, please reopen.