[FieldTrip] preprocessing with and without "preproc" added

Lei, A. (Anqi) anqi.lei at ru.nl
Thu Apr 7 12:42:47 CEST 2022


Hello there,

I'm wondering about the consequence of adding "preproc" to the preprocessing parameters (e.g. using "cfg.preproc.lpfilter") versus not adding it (e.g. just using "cfg.lpfilter").

I first tried preprocessing my data without adding "preproc" and got this following ft_fetch_data error when I tried to visualize the data using databrowser. However, after I added "preproc" to all the parameters, I no longer got this error and can visualize the data properly. Also, it seems like adding "preproc" changes the values in data_eeg.trial.

[cid:image001.png at 01D84A7C.FBAA6D00]

My preprocessing steps without adding "preproc" (gave me the error when I tried to visualize data_eeg):


    cfg                     = [];

    cfg.dataset             = vhdr;                                 % raw data file name

    cfg.trialfun            = 'ft_trialfun_general';                % selecting all trials for now

    cfg.trialdef.prestim    = 0.5;                                  % time before marker in seconds (should be generous to avoid filtering artifacts)

    cfg.trialdef.poststim   = 1.5;                                    % time after marker in seconds (should be generous to avoid filtering artifacts)

    cfg.trialdef.eventvalue = {'S 12', 'S 14', 'S 13', 'S 15'};     % markers marking stimulus events in the final test

    cfg.trialdef.eventtype  = 'Stimulus';



    % Define trials (in cfg.trl)

    cfg                     = ft_definetrial(cfg);                  % fieldtrip function that specifies trials



    % rereferencing data

    cfg.reref               = 'yes';                                % data will be rereferenced

    cfg.channel             = setdiff(1:32, [1,12,17,32]);          % in this step only for the EEG channels (including the right mastoid, elec 9)

    cfg.implicitref         = 'Ref';                                % the implicit (non-recorded) reference channel is added to the data representation

    cfg.refchannel          = {'TP10', 'Ref'};                  % the average of these channels is used as the new reference



    % filtering data

    cfg.lpfilter            = 'yes';                                % data will be lowpass filtered

    cfg.lpfreq              = 40;                                   % lowpass frequency in Hz

    cfg.hpfilter            = 'no';                                 % data will NOT be highpass filtered, as this was already done online



    % baseline correction

    cfg.demean              = 'yes';



    % apply the set parameters on the data

    data_eeg            = ft_preprocessing(cfg);



My preprocessing steps after adding "preproc" (this did not give me error when I visualized data_eeg):
 % defining settings for trial selection
    cfg                     = [];
    cfg.dataset             = vhdr;                                 % raw data file name
    cfg.trialfun            = 'ft_trialfun_general';                % selecting all trials for now
    cfg.trialdef.prestim    = 0.5;                                  % time before marker in seconds (should be generous to avoid filtering artifacts)
    cfg.trialdef.poststim   = 1.5;                                    % time after marker in seconds (should be generous to avoid filtering artifacts)
    cfg.trialdef.eventvalue = {'S 12', 'S 14', 'S 13', 'S 15'};     % markers marking stimulus events in the final test
    cfg.trialdef.eventtype  = 'Stimulus';

    % Define trials (in cfg.trl)
    cfg                     = ft_definetrial(cfg);                  % fieldtrip function that specifies trials

    % rereferencing data
    cfg.preproc.reref               = 'yes';                                % data will be rereferenced
    cfg.channel                     = setdiff(1:32, [1,12,17,32]);          % in this step only for the EEG channels (including the right mastoid, elec 9)
    cfg.preproc.implicitref         = 'Ref';                                % the implicit (non-recorded) reference channel is added to the data representation
    cfg.preproc.refchannel          = {'TP10', 'Ref'};                  % the average of these channels is used as the new reference
    % filtering data
    cfg.preproc.lpfilter            = 'yes';                                % data will be lowpass filtered
    cfg.preproc.lpfreq              = 40;                                   % lowpass frequency in Hz
    cfg.preproc.hpfilter            = 'no';                                 % data will NOT be highpass filtered, as this was already done online

    % baseline correction
    cfg.preproc.demean              = 'yes';
    %cfg.baselinewindow      = [-0.2 0];                            % no baseline correction necessary

    % apply the set parameters on the data
    data_eeg                       = ft_preprocessing(cfg);



Could you let me know why this might be the case?


Thank you!

Best,
Anqi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20220407/b2e7191a/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 70036 bytes
Desc: image001.png
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20220407/b2e7191a/attachment.png>


More information about the fieldtrip mailing list