[FieldTrip] Discrepancy between FieldTrip and SPM artefact rejection functions (thresholding)
Cihan Dogan
CDogan1994 at hotmail.co.uk
Sat Aug 7 13:55:05 CEST 2021
Hi Jan,
Many thanks for getting back to me so promptly.
So the overall number of trials is approximately 430 trials per participant. I do call ft_preprocessing after the code I linked. In terms of the typo, I manually typed the commands into email, my bad! Finally, the baseline subtraction and filtering should be the same between platforms, I’ll double check this today. And indeed, both are using the same 118 electrodes.
I’ll have a closer look into this today/tomorrow and return with my findings.
Thanks for the help!
Cihan
From: fieldtrip <fieldtrip-bounces at science.ru.nl> On Behalf Of Schoffelen, J.M. (Jan Mathijs) via fieldtrip
Sent: 06 August 2021 09:27
To: FieldTrip discussion list <fieldtrip at science.ru.nl>
Cc: Schoffelen, J.M. (Jan Mathijs) <janmathijs.schoffelen at donders.ru.nl>
Subject: Re: [FieldTrip] Discrepancy between FieldTrip and SPM artefact rejection functions (thresholding)
Hi Cihan,
I never use SPM myself, so I cannot comment on what is going on under the hood there.
Just one or two pointers and questions for now:
- what’s the overall number of trials? To get a feel about the discrepancy, it would be relevant to know this.
- just to be sure: after specifying the cfg for preprocessing, you actually call ft_preprocessing, right? The code you pasted in your e-mail does not mention that.
- there’s a typo in the cfg for ft_artifact_threshold: ‘continious' should read ‘continuous', although that would probably not explain your observations.
- one potential difference in the processing steps between SPM and FT could be the order of the filtering and baseline subtraction.
- the set of channels used in both SPM and FT are the same?
Anyway, no definitive answer here, but if you want to get to the bottom of this, I’d first compare the ‘preprocessed’ data, without the whole thresholding machinery applied. Just inspect the time courses for offset differences etc. This would then give pointers as to why the numbers are so different.
Best wishes,
Jan-Mathijs
On 6 Aug 2021, at 00:26, Cihan Dogan via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:
Dear Fieldtrip Experts,
Recently I have been in the process of moving my pre-processing pipeline from SPM to Fieldtrip. Originally, I started my analysis in SPM, then moved over to Fieldtrip, however, I was using functions provided by FieldTrip to convert the SPM data straight to FieldTrip removing the need for me to reprocess my data.
I decided to move this pre-processing over to FieldTrip rather than relying on two analysis programs. I am facing an issue whereby a large difference exists for the number of trials rejected using FieldTrips ‘ft_artifact_threshold’ versus SPM which I do not understand given my parameters for pre-processing are the same, and thresholding is a relatively simple process.
I could understand slight differences, but not this large. To double check I also reprocessed my files in SPM since it had been a while (no change).I linked below an example of how many trials get rejected for six participants (I have a dataset of 40). As seen, the discrepancy is quite large in some cases, for example participant 23.
I hope I am making a silly mistake somewhere and missing a setting, hopefully an expert can spot it!
Thanks in advance,
Cihan
FieldTrip Configuration Summary:
Preprocessing:
cfg = []
cfg.demean = ‘yes’;
cfg.baselinewindow = [-0.2, 0];
cfg.lpfilter = ‘yes’;
cfg.hpfilter = ‘yes’;
cfg.lpfreq = 30;
cfg.hpfreq = 0.1
cfg.lpfiltord = 5;
cfg.hpfiltord = 5;
Artefact Rejection:
Thresholding -100 to 100 uV
cfg = [];
cfg.continious = ‘no’;
cfg.artfctdef.threshold.min = -100;
cfg.artfctdef.threshold.max = 100;
cfg.artfctdef.threshold.channel = get_eeg_channels(data);
cfg.artfctdef.threshold.bpfilter = ‘no’;
[cfg, artifact] = ft_artifact_threshold(cfg, data);
cfg = [];
cfg.artfctdef.reject = 'complete';
cfg.artfctdef.zvalue.artifact = artifact; % this doesn’t make a difference given we only have 1 set of artifacts
postprocessed = ft_rejectartifact(cfg, data);
SPM Configuration Summary:
Filtering 0.1 30 Hz
matlabbatch{1}.spm.meeg.preproc.filter.type = 'butterworth';
matlabbatch{1}.spm.meeg.preproc.filter.band = 'bandpass';
matlabbatch{1}.spm.meeg.preproc.filter.freq = [0.1 30];
matlabbatch{1}.spm.meeg.preproc.filter.dir = 'twopass';
matlabbatch{1}.spm.meeg.preproc.filter.order = 5;
baseline -200 to 0 ms
matlabbatch{1}.spm.meeg.preproc.bc.timewin = [-200 0];
Thresholding -100 to 100 uV
matlabbatch{1}.spm.meeg.preproc.artefact.mode = 'reject';
matlabbatch{1}.spm.meeg.preproc.artefact.badchanthresh = 0.5;
matlabbatch{1}.spm.meeg.preproc.artefact.append = true;
matlabbatch{1}.spm.meeg.preproc.artefact.methods.channels{1}.type = 'EEG';
matlabbatch{1}.spm.meeg.preproc.artefact.methods.fun.threshchan.threshold = 100;
matlabbatch{1}.spm.meeg.preproc.artefact.methods.fun.threshchan.excwin = 1000;
6 Participant Example
Participant
SPM Reject
FieldTrip Reject
23
221
141
24
257
295
25
260
227
26
80
55
27
284
271
28
178
164
39
159
128
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!vLTGG-Iql13sRmyQWAgFmTmxPKaUG9bo3LN8yj1yKhaKO18YQKRI0lDKyoX-yez0GP2aD5WfTxqxQdY$<https://urldefense.com/v3/__https:/doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!vLTGG-Iql13sRmyQWAgFmTmxPKaUG9bo3LN8yj1yKhaKO18YQKRI0lDKyoX-yez0GP2aD5WfTxqxQdY$>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20210807/d9cc7ac7/attachment.htm>
More information about the fieldtrip
mailing list