[FieldTrip] Baseline correction on TFR with baseline period in separate trial

Schoffelen, J.M. (Jan Mathijs) janmathijs.schoffelen at donders.ru.nl
Fri Mar 22 08:08:54 CET 2024


Hi Meedy,

If you want to use data from different ’trials’ as the one for TFR baseline correction, here’s a few thoughts:

- it probably does not make sense to divide the TFR of interest by another TFR (i.e. time-resolved matrix), there is not much special about a specific time-point during what you define as the baseline window in relation to a similar time-point in the TFR of interest. Therefore, I would always average across time for the baseline window.
- there is no dedicated function in fieldtrip that can achieve this, but you may look into ft_math as a more generic function that can be used to do mathematical operations on the numeric data in a data-structure (and keeping track of this in the cfg). For instance, you could call ft_math with an additional cfg.matrix in the input, which with an appropriately defined cfg.operation will perform the baseline-correction for you. Alternatively, you can just do the computation by ‘hand’ in matlab code, which makes you lose the trace of the baseline operation in the cfg.previous.previous.

Best wishes and happy computing,
Jan-Mathijs


> On 15 Mar 2024, at 18:33, Meedy via fieldtrip <fieldtrip at science.ru.nl> wrote:
>
>
> Hi Fieldtrippers!
>
> I am quite new to fieldtrip and coding and would love some help and/or suggestions. I am investigating brain mechanism behind binary communication, more precisely I am trying to distinguish positive answers from negative ones.
>
> I have data from 3 patients and at the moment want to conduct a between trial single subject comparison.
>
> The paradigm of my data is generally :
>
> Trigger S 10 or S 11: baseline period (5-10s) --- Trigger S5 or S6: Question period (length varies) ---- Trigger S 4 or S 8: Thinking period (10-15s)
>
> I have preprocessed the data, defining trials at baseline triggers and thinking triggers like this:
>
>        cfg = [];
>        cfg.dataset = vhdrFile;
>        cfg.trialfun = 'ft_trialfun_general';
>        cfg.trialdef.eventtype = 'Stimulus';
>        cfg.trialdef.eventvalue = {'S  4' 'S  8' 'S 10' 'S 11'};
>        % thinking trigger: S4 for yes answers, S8 for no,
>        % baseline trigger: S10 before yes question/answer, S11 for no
>        cfg.trialdef.prestim = 2;
>        cfg.trialdef.poststim = 5; % only first 3 seconds plus 2 sec padding
>        cfg = ft_definetrial(cfg);
>
>        cfg.continuous = 'yes';
>        cfg.channel = {'all'}; % only EEG
>        cfg.detrend = 'yes';
>        cfg.demean = 'yes';
>        cfg.reref = 'yes';
>        cfg.refchannel = 'all';
>        cfg.refmethod = 'avg';
>        cfg.bpfilter = 'yes';
>        cfg.bpfiltord = 3;
>        cfg.bpfilttype = 'but';
>        cfg.bpfreq = [0.5 45];
>        cfg.dftfilter = 'yes';
>        cfg.dftfreq = [50 100];
>
>        % save data in same location as its corresponding file
>        [~, fileName, ~] = fileparts(vhdrFile);
>        cfg.outputfile = fullfile(vhdrFiles(i).folder, [fileName, '_data']);
>        ft_preprocessing(cfg);
>
> Next I did a TF decomposition, below are the settings I have used
>
>    cfg         = [];
>    cfg.method  = 'mtmconvol';
>    cfg.output  = 'pow'; % return power-spectra
>    cfg.channel = 'all';
>    cfg.trials  = 'all';
>    cfg.keeptrials = 'no'; % 'yes' for cluster based permuatation test between trials, 'no' results in average
>    cfg.taper   = 'hamming';
>    cfg.foi     = 1:45;
>    cfg.t_ftimwin = ones(length(cfg.foi),1); % length of time window 1 sec
>    cfg.toi = -1:0.05:3;
>
>    cfg.trials       = find(data.trialinfo(:,1) == 4);
>    tfdata_yes = ft_freqanalysis(cfg, data);
>
>    cfg.trials       = find(data.trialinfo(:,1) == 8);
>    tfdata_no = ft_freqanalysis(cfg, data);
>
>
> Now I want to dB baseline correct the thinking epochs (S4 and S8) using the baseline epochs (S10 and S11). From what I could find online, usually one would use pre-stimulus period for baseline correction. With my data, the pre-stimulus period is inside the question period hence why there is another baseline period before that. I am quite confused on how to do this correctly.
>
> I'd really appreciate any ideas on this,
> Meedy
>
> _______________________________________________
> fieldtrip mailing list
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.science.ru.nl%2Fmailman%2Flistinfo%2Ffieldtrip&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C93ccf191efdd4aaeac0c08dc4a3eef43%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638466881361342337%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=OpDPvuMXIM23Ulcnq3Olrng59QtoYH00oITSG53E9xs%3D&reserved=0
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoi.org%2F10.1371%2Fjournal.pcbi.1002202&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C93ccf191efdd4aaeac0c08dc4a3eef43%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638466881361342337%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=Bs8%2FjP9MU%2BkIY8PCPjK8TigefhSe4rGNk8nyDEgqpfU%3D&reserved=0




More information about the fieldtrip mailing list