[FieldTrip] CTF data event/reading

Robert Oostenveld r.oostenveld at donders.ru.nl
Sun Sep 2 12:54:22 CEST 2012

Hi Baris,

First something in general: This error

> Undefined function 'offset2time' for input arguments
> of type 'double'.
> Error in ft_preprocessing (line 511)
>      tim = offset2time(offset, hdr.Fs, size(dat,2));

should not happen with recent versions of FieldTrip (nor with older ones). The offset2time helper function is present in fieldtrip/private and can be found there by ft_preprocessing.

Also the error

> Undefined function 'ft_getuserfun' for input arguments
> of type 'char'.
> Error in ft_definetrial (line 140)
>  cfg.trialfun = ft_getuserfun(cfg.trialfun,
>  'trialfun');

suggests that your fieldtrip installation is broken. Please upgrade to the most recent version, that might resolve some (or all) of your problems. Don't move around the directories in the fieldtrip zip file, or rename them, otherwise ft_defaults is not able to set up the path correctly. See also http://fieldtrip.fcdonders.nl/faq/should_i_add_fieldtrip_with_all_subdirectories_to_my_matlab_path

Then on to some other aspects of your question, which may be of interest to other CTF users as well. 

From the CTF channel naming scheme I can see that you have a CTF275 system. The 151 channel MEG system we started off with at the Donders in 2002 had an electronics rack which was placed such that there was a clear front and back side. Each side of the rack exposed 16 binary inputs (i.e. bits) for connecting external triggers. To the front we connected the button boxes, to the back we connected the stimulus presentation computer. The 16 bits from the front and from the back were combined in the 32 bit STIM channel.

Given the connections of the button boxes and stimulus computers, in the analysis the 32 bit STIM channel did not match the users scripts with respect to button box and presentation trigger codes. Therefore the FieldTrip reading software was implemented to split the 32 bits into the 16 frontpanel and the 16 backpanel bits. This also shifts the bits to recover the trigger codes that were used in the presentation software by the users. This situation from early '2000 at the Donders in Nijmegen is still supported by FieldTrip. The “Subject01.ds” tutorial dataset is from that time, so that is why you see it in the tutorials.

The front and back panel at other CTF sites with the old electronics rack may be (or have been) connected differently. Furthermore, the present CTF systems have more trigger input options and no front and back side any more, so better don't use those any more in your analyses. In many cases UPPT001 and similarly named channels are the interesting trigger channels. MEG data acquired with the older CTF systems uses the STIM channel.

So please be aware that “frontpanel” and “backpanel” are Donders conventions that have ended up in FieldTrip, but may not be of any relevance to you.

Another topic is that in Nijmegen (as many other CTF sites) we record the data continuously, and don't use the CTF software for epoching, classification of artifacts and trial marking. However FieldTrip does support the CTF ClassFile and Markerfile in FieldTrip.

If you do ft_read_event('dataset.ds') you will see an event structure that combines all information. Some "events" are instantaneous, some "events" have a duration. This is explained in more detail at http://fieldtrip.fcdonders.nl/faq/what_is_the_relation_between_events_such_as_triggers_and_trials

best regards,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20120902/c8faa3c0/attachment-0002.html>

More information about the fieldtrip mailing list