[FieldTrip] Question about ft_read_event and read_trigger - Neuromag .fif file

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Wed Aug 26 08:36:49 CEST 2020


Dear Justyna,

I am sorry that you are experiencing problems reading in the trigger information. I am not working extensively with Vectorview data myself, but I am quite sure that there are many people (also subscribed to this list) that use FieldTrip successfully for this type of data. My first thought therefore is that there might be something wrong on your end, either with your data, or with the code that you are using.
Regarding the latter, you report that ‘read_trigger’ is called in ft_read_event at line 1473. In my version of the code this is not the case, so this suggests that you are using a slightly outdated version of the software. Before we embark on a possible wild goose hunt, I therefore suggest to download a more recent version of FieldTrip (i.e. the most recent one), and first try whether your problem persists. If it does, we can take it from there.

Best wishes,
Jan-Mathijsk


> On 20 Aug 2020, at 16:51, Justyna Gula <justyna.j.gula at gmail.com> wrote:
> 
> Dear all,
> I have a problem using the ft_read_event function. I am trying to read events from MEG data in a .fif file (306-channel Vectorview system, Elekta Neuromag, Helsinki, Finland). I am interested in the STI101 channel which is described as 'digital trigger' in the header. Unfortunately, the value field of the output is different than expected (I read the file in Python using the MNE library and I get correct results).
> 
> I noticed that in line 1463 of the ft_read_event function binaryindx is found as 'digital trigger' in channel type, but later read_trigger function is called (line 1473), which looks for 'binary trigger' in channel type (line 139 of read_triger function). If I stop the code before line 139 in read_trigger function, change the type of the channel STI101 into 'binary trigger' from 'digital trigger' and continue, I get correct results.
> 
> I would like to ask if my change makes sense and what can be the cause of the wrong value field of the output without the change.
> 
> Thank you for your help and best wishes,
> Justyna Gula
> 
> %%
> I call the function:
> events= ft_read_event(filename,'type','STI101');
> 
> Part of the ft_read_event function:
> 
> analogindx = find(strcmp(ft_chantype(hdr), 'analog trigger'));
> otherindx  = find(strcmp(ft_chantype(hdr), 'other trigger'));
> binaryindx = find(strcmp(ft_chantype(hdr), 'digital trigger'));
> 
> and later:
> 
> if ~isempty(binaryindx)
>         trigger = read_trigger(filename, 'header', hdr, 'dataformat', dataformat, 'begsample', flt_minsample, 'endsample', flt_maxsample, 'chanindx', binaryindx, 'detectflank', detectflank, 'trigshift', trigshift, 'fixneuromag', false);
>         event   = appendevent(event, trigger);
>  end
> 
> Part of the read_trigger function:
> 
> switch hdr.chantype{chanindx(1)}
>       case 'binary trigger'
>         if any(dat(k,:)<0)
>           dat(k,:) = double(typecast(int16(dat(k,:)), 'uint16'));
>         end
>       case 'analog trigger'
>         % keep it as it is
>       case 'other trigger'
>         % keep it as it is
> 
> _______________________________________________
> fieldtrip mailing list
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> https://doi.org/10.1371/journal.pcbi.1002202




More information about the fieldtrip mailing list