[FieldTrip] access to GDF file

Sina Makhdoomi Kaviri sinam1 at umbc.edu
Thu May 2 21:04:41 CEST 2024


On the other hand, I would like to note that I have access to event types
by biosig in EEGLAB, but how can I convert the data to the fieldtrip as
well because as I mentioned there appear some errors after reading it in
fieldtrip.

On Thu, May 2, 2024 at 2:50 PM Sina Makhdoomi Kaviri <sinam1 at umbc.edu>
wrote:

> Hi,
> Thanks for your response and consideration.
> I am still waiting for an effective reply, meanwhile I tried different
> codes to access the event code and how I can preprocess this data
> initially, so I use the following code and you can see the warning.
> >> dataset = './dataset/S03_ME/motorexecution_subject3_run1.gdf';
> >> hdr    = ft_read_header(dataset);
> data   = ft_read_data(dataset, 'header', hdr );
> events = ft_read_event(dataset, 'header', hdr );
> Warning: BIOSIG does not have a consistent event representation, skipping
> events
>
> On Thu, May 2, 2024 at 2:46 PM Schoffelen, J.M. (Jan Mathijs) via
> fieldtrip <fieldtrip at science.ru.nl> wrote:
>
>> Hi,
>>
>> As you may have already found in the fieldtrip documentation in
>> https://fieldtriptoolbox.org
>> <https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Ffieldtriptoolbox.org%2F&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C041d95ebd14c4d74a35b08dc6ad7c2fd%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638502722122927280%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=e3lKBaeNOr78IAhf0y%2FWHS25AkWaWyd6VXz0CwNucyE%3D&reserved=0>,
>> events are read in by the function ft_read_event.
>>
>> I guess you have already started inspecting the code in ft_read_event
>> using the MATLAB debugger, and you may have found the relevant lines
>> 484-504 dealing with the .gdf file format.
>>
>> I assume (although you did not explicitly mention this) that
>> ft_read_event in the case of the dataset that you mentioned returns an
>> empty event structure, which means that you will have had the warning on
>> your screen that is in line 500. In other words, based the specific data
>> organization in the file, FieldTrip does not know how to interpret the
>> trigger information.
>>
>> Continuing the detective work, you will have noticed that in line 492 the
>> function ft_read_header is called, producing a variable hdr, based on which
>> consecutively a ’statusindex’ is determined, which consecutively determines
>> whether or not the warning is thrown. Now, if we take a close look at the
>> section in ft_read_header that deals with .gdf files, you will see in line
>> 1545 that the read_biosig_header function is used to read in the metadata
>> from the datafile. The read_biosig_header function uses biosig’s sopen
>> function to do the heavy lifting.
>>
>> Apparently, there has never been somebody who managed to write some ‘glue
>> code’ that translates the events which are not represented on a digital
>> STATUS channel into a representation that FieldTrip can work with.
>>
>> We look forward to a generic implementation that broadcasts the events
>> from the biosig header to FieldTrip as an improvement to be able to deal
>> with a broader selection of .gdf files. Please submit your suggested code
>> changes as a PR to our toolbox’s repository on github, which is located at
>> https://github.com/fieldtrip/fieldtrip
>> <https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ffieldtrip%2Ffieldtrip&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C041d95ebd14c4d74a35b08dc6ad7c2fd%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638502722122927280%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=VgMRfCSYwh76Csyl1ftaNVdeTVu%2Bfjh9fxSMxWlYaj8%3D&reserved=0>
>> .
>>
>> Best wishes and happy coding,
>> Jan-Mathijs
>>
>>
>>
>> On 2 May 2024, at 19:04, Sina Makhdoomi Kaviri via fieldtrip <
>> fieldtrip at science.ru.nl> wrote:
>>
>> I want to add this note that if I uploaded the dataset into the fieldtrip
>> directly, it does not recognize the dataset related to specific event type.
>> Please help me how can I access the event code in this dataset and
>> separate it to process in the beamforming method. Here is my code:
>> dataset = './dataset/S03_ME/motorexecution_subject3_run1.gdf';
>> cfg = [];
>> cfg.dataset = dataset;
>> cfg.trialdef.eventtype = '1541'; % get a list of the available types
>> cfg.trialfun = 'ft_trialfun_general';
>> cfg.trialdef.triallength = 1; % duration in seconds
>> cfg = ft_definetrial(cfg);
>> cfg.dftfreq = [50];
>> cfg.channel = 'EEG';
>> data_segmented = ft_preprocessing(cfg);
>>
>>
>> On Thu, May 2, 2024 at 11:16 AM Sina Makhdoomi Kaviri <sinam1 at umbc.edu>
>> wrote:
>>
>>> To whom it may concern,
>>>
>>> I want to implement, "A novel explainable machine learning approach for
>>> EEG-based brain computer interface systems" published in Springer Nature,
>>> in fieldtrip. Regarding that they used (
>>> http://bnci-horizon-2020.eu/database/data-sets
>>> <https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fbnci-horizon-2020.eu%2Fdatabase%2Fdata-sets&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C041d95ebd14c4d74a35b08dc6ad7c2fd%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638502722122927280%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=ZOMkv3C374WwkbTOVhUOsCt6J3AdtFPZKsX9aprONac%3D&reserved=0>
>>> (Accession Number 001-2017)) as dataset in GDF file, I want to preprocess
>>> and use ft_definetrial, but it is not accessed to the event code. In this
>>> regard I use EEGLAB to load the dataset with biosig, after that when I
>>> convert to fieldtrip (eeglab2fieldtrip or save it and use ft_read_event,..)
>>> I face this problem as follows. Could you please help me how can I
>>> preprocess this dataset for beamforming source localization for specific
>>> event code.
>>>
>>> Error using isfolder
>>> Input path must be text.
>>>
>>> Error in ft_filetype (line 166)
>>> if isfolder(filename)
>>>
>>> Error in dataset2files (line 42)
>>>   format = ft_filetype(filename);
>>>
>>> Error in ft_checkconfig (line 675)
>>>     [cfg.dataset, cfg.headerfile, cfg.datafile] =
>>> dataset2files(cfg.dataset, []);
>>>
>>> Error in ft_preprocessing (line 385)
>>>   cfg = ft_checkconfig(cfg, 'dataset2files', 'yes');
>>>
>>>
>>> _______________________________________________
>> fieldtrip mailing list
>> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>> <https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.science.ru.nl%2Fmailman%2Flistinfo%2Ffieldtrip&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C041d95ebd14c4d74a35b08dc6ad7c2fd%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638502722122927280%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=YhPuPSYLY9PdP15Bv%2BN2M31GC0xzH2szXFlAgj85Xtw%3D&reserved=0>
>> https://doi.org/10.1371/journal.pcbi.1002202
>>
>>
>> _______________________________________________
>> fieldtrip mailing list
>> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>> https://doi.org/10.1371/journal.pcbi.1002202
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20240502/b82d95b6/attachment.htm>


More information about the fieldtrip mailing list