[FieldTrip] Updating trial information

Arana, S.L. (Sophie) S.Arana at donders.ru.nl
Thu Jul 18 09:07:57 CEST 2019


Hi Carolina,


I am not sure whether there is a reason why you read the data in as continuous first? If not your pipeline might be more efficient if you first define the trials with ft_definetrial and then read in / segment / filter the data by passing the resulting cfgout to ft_preprocessing (basically following this tutorial http://www.fieldtriptoolbox.org/tutorial/preprocessing/) and subsequently use ft_databrowser on the already segmented trials.


If you need to stick to your order of processing steps, then maybe the function you are looking for is ft_redefinetrial, which allows you to cut data into trials at a later stage.


best,

Sophie


________________________________
From: fieldtrip <fieldtrip-bounces at science.ru.nl> on behalf of Carolina Ogawa <carolyogawa at gmail.com>
Sent: Wednesday, July 17, 2019 5:22 PM
To: fieldtrip at science.ru.nl
Subject: [FieldTrip] Updating trial information

Dear community,

My name is Carolina Ogawa, and I'm working with EEG at the University of Sao Paulo, Brazil. I intend to analyze oscillatory gamma activity from the EEG data I recorded.

I'd like to know how I get the trial information (the information stored in "cfg.event" and "cfg.trl") updated after rejecting segments of data (due to artifacts), so that my data will be correctly segmented into trials afterwards.

My pipeline involves, in the following order:

  1.  Rereferencing and filtering (ft_preprocesing)

(cfg definition)
...
data_filt      = ft_preprocessing(cfg);

  2.  Defining trials with ft_definetrial (so that I have the trials information stored on "cfgout.trl")

    cfg                            = [];
    cfg.dataset                 = fullfile(path_inputData,subject{i});
    cfg.trialdef.eventtype = 'Stimulus';
    cfg.trialfun                   = 'ft_trialfun_general';
    cfgout                         = ft_definetrial(cfg);

  3.  Removing segments with artifacts, using ft_databrowser and ft_rejectartifact. (EEG data is continuous up to this point).

    cfg               = [];
    cfg.continuous    = 'yes';
    cfg.channel       = 'all';
    cfg.viewmode      = 'butterfly';
    artif             = ft_databrowser(cfg, data_filt);

    cfg                        = [];
    cfg.artfctdef.minaccepttim = 0.010;
    cfg.artfctdef.reject       = 'partial';
    cfg.artfctdef.visual.artifact = artif.artfctdef.visual.artifact;
    data_rejInt = ft_rejectartifact(cfg, data_filt);


I tried using "ft_recodeevent", as follows:
cfg = [];
trl = cfgout.trl;
cfg.trl = trl;
cfg.eventtype = 'Stimulus';
[ev] = ft_recodeevent(cfg, data_rejInt);

but I get this error:
Error using ft_recodeevent (line 114) could not locate event structure in the data


Can someone tell me if there something wrong with the "cfg" settings of if I'm using an improper function to this situation? I also tried running "ft_rejectartifact" with "cfg" as the only input parameter, expecting that the output would be a "cfg" structure with an updated "trl" (as described in the "ft_rejectartifact" reference page). Instead, what I receive is the error:

Undefined function or variable "trl".
Error in ft_rejectartifact (line 252) if isempty(trl)


Any help would be appreciated,

Best,
Carolina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190718/309e2fc9/attachment-0002.html>
-------------- next part --------------
_______________________________________________
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