[FieldTrip] Error using ft_write_data

Schoffelen, J.M. (Jan Mathijs) janmathijs.schoffelen at donders.ru.nl
Thu Mar 10 07:59:00 CET 2022


Dear Yannick,

In general, FieldTrip has a data2bids function, which might already provide you with an avenue to achieve what you want. There is quite a lot of documentation on the fieldtrip website, so with a targeted search I am sure you can find a lot of information that can get you further.

Specific to the error that you got, however, the cause of it is a ‘hard coded’ error message on line 737 of ft_write_data. That is: the function does not support the writing of events in EDF-format, which typically is in the form of an annotation channel in de data file.

BIDS, on the other hand, typically has events stored in an <some-name>_events.tsv file, where <some-name> has the same name as the dataset. So in your case, I’d look for a way to write a fieldtrip event structure to a tsv file, rather than adding the EVENT structure as an input to ft_write_data. There is functionality in fieldtrip that can help you on your way (again, see data2bids documentation + references therein).

Good luck, and keep up the good work,

Jan-Mathijs


On 9 Mar 2022, at 17:28, LONGUET Yannick via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

Dear community,
My name is Yannick Longuet and I am a master 2 student, working in ICM (Paris Brain institute) in Paris on Human intracranial-EEG data.

I would like my dataset to follow the BIDS specification but my iEEG data are stored in the Poly5 format (TMSI). That's why I am looking to convert my i-EEG data in the European Data Format (EDF)

I've been trying to use the ft_write_data() function for the conversion for several days but without success.

 Here is my code :

filename_data='RUN01.Poly5'

cfg = [];
cfg.dataset = filename_data;
cfg.continuous = 'yes';
cfg.chanel = 'all';
data_unfilt  = ft_preprocessing(cfg);
DATA=data_unfilt.trial;
HEADER=ft_read_header(filename_data);
EVENT=ft_read_event(filename_data)




ft_write_data('Youyfu.edf', DATA,'header',HEADER,'event',EVENT,'dataformat','edf')


And here is the error message :

EVENT =

  1×252 struct array with fields:

    type
    sample
    value
    offset
    duration

Error using ft_write_data (line 740)
writing events is not supported

Do you have any idea what could be causing the problem?
Any help would be appreciated.

Best regards

Yannick

_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!_oEKUTWsK_tD30q4LeWIJh28nlL5NfhwXDGJO-aUVivQkkkMedlReE-NeLzXBDiuEedVEg9LXW2UOlyQroAmNW8SJWIwlwUVA_XP0Q$

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20220310/e7245b8b/attachment.htm>


More information about the fieldtrip mailing list