[FieldTrip] Baseline correction when epoching after filtering

Emil Østergård Johansen emilj at drcmr.dk
Mon Jun 27 10:53:25 CEST 2016


Dear all,
I cannot figure out how to subtract a baseline window in each trial, say [-2.0 0] when using ft_redefinetrial to epoch my data.
As far as I can see baseline correction is only an option for ft_preprocessing. 
My pipeline is as follows:
1) Run ICA on data which is preprocessed in a manner specifically for ICA 
2) Apply ICA weights to raw data (after this my data is in .mat format)
3) Reref and filter using ft_preprocessing
4) Epoch data using ft_definetrial and ft_redefinetrial

The code for epoching is as follows and works fine:

cfg.dataset = [cfg.subjectdir cfg.subjectstr '.bdf’]; % Raw data for defining trials
cfg_cond    = ft_definetrial(cfg);
cfg_cond.inputfile   = [cfg.subjectdir cfg.subjectstr '_ICApruned_filtered.mat’];
data   = ft_redefinetrial(cfg_cond);

I want to subtract the baseline window when epoching (and epoching should be done after filtering to minimize filter artifacts).
I tried using ft_preprocessing again to both subtract baseline and epoch the data (instead of ft_redefinetrial):

cfg.dataset = [cfg.subjectdir cfg.subjectstr '.bdf’]; % Raw data for defining trials
cfg_cond    = ft_definetrial(cfg);
cfg_cond.inputfile   = [cfg.subjectdir cfg.subjectstr '_ICApruned_filtered.mat’];
cfg_cond.demean = 'yes';
cfg_cond.baselinewindow = [-2.0 0];
data = ft_preprocessing(cfg_cond); 

but got: "Warning: The field cfg.trl is forbidden, it will be removed from your configuration” and no trials were created.

You might suggest that I include the cfg.demean in step 3 when filtering, but then I am unsure if it will simply demean the entire dataset using the same value since the data is continuous at that point.
If it is of importance I have my own trial function 

Thank you for your time,
Emil Johansen
Hvidovre University Hospital
Denmark



More information about the fieldtrip mailing list