[FieldTrip] filtering during artifact detection
Diego Lozano-Soldevilla
dlozanosoldevilla at gmail.com
Wed Oct 26 15:47:08 CEST 2016
Hi Maximilien and Florian,
Thank for letting us know. I can reproduce your problem and the problem
relies in an unfortunate combination of fieldtrip defaults in some
functions. The issue starts with the cfg.artfctdef.eog.fltpadding default
which is 0.1. This parameter introduces a 0.1s padding with NaNs (line 301
in ft_artifact_zvalue) and the private function preproc.m does not filter
the data because it contains NaNs. For now, set explicitly
cfg.artfctdef.eog.fltpadding = 0; to carry on while we fix it:
cfg=[];
cfg.artfctdef.eog = [];
cfg.artfctdef.eog.bpfilter = 'yes';
cfg.artfctdef.eog.bpfilttype = 'but';
cfg.artfctdef.eog.bpfreq = [8 10];
cfg.artfctdef.eog.bpfiltord = 4;
cfg.artfctdef.eog.channel = 'MLF22';
cfg.artfctdef.eog.trlpadding = 0;
cfg.artfctdef.eog.fltpadding = 0;
cfg.artfctdef.eog.interactive = 'yes';
cfg.artfctdef.eog.cutoff = 2.5;
[cfg, artifact] = ft_artifact_eog(cfg,data);
You can follow the development of the issue here:
http://bugzilla.fieldtriptoolbox.org/show_bug.cgi?id=3193
Best,
Diego
On 26 October 2016 at 14:36, Florian Gerard-Mercier <florian at brain.riken.jp>
wrote:
> Dear all,
>
> Note that I encountered the same problem (absence of intended filtering)
> when using high-level ft_preprocessing function (I talked about it in a a
> precedent email).
> I solved the problem by doing the filtering separately, as a first step,
> and using the low-level ft_preprocbandstopfilter function.
> Anyway I needed access to the data in an unstructured format (i.e. just a
> matrix, easy to manipulate), so in the end this low-level function fitted
> my needs better.
>
> All the best,
>
> Florian
>
> On 26 Oct, 2016, at 9:27 PM, Maximilien Chaumon <
> maximilien.chaumon at gmail.com> wrote:
>
> Thank you Diego for your quick reply.
> Whether or not I include those filter parameters explicitly does not
> change anything.
> This is what i have now:
>
> cfg.artfctdef.eog = [];
> cfg.artfctdef.eog.bpfilter = 'yes';
> cfg.artfctdef.eog.bpfilttype = 'but';
> cfg.artfctdef.eog.bpfreq = [1 15];
> cfg.artfctdef.eog.bpfiltord = 4;
>
> cfg.artfctdef.eog.channel = eogchans;
> cfg.artfctdef.eog.trlpadding = 0;
> cfg.artfctdef.eog.interactive = 'yes';
> cfg.artfctdef.eog.cutoff = 2.5;
>
> [cfg, artifact{iC,iD}] = ft_artifact_eog(cfg,data);
>
>
> but the resulting interactive window looks like this:
>
>
> Seems like the preprocessing step isn't applied... any clue why that is?
>
>
> Le mer. 26 oct. 2016 à 11:35, Diego Lozano-Soldevilla <
> dlozanosoldevilla at gmail.com> a écrit :
>
>> Dear Maximilien,
>>
>> You should specify the filter parameters in the cfg:
>>
>> cfg.artfctdef.eog.bpfilter = 'yes'
>> cfg.artfctdef.eog.bpfilttype = 'but';% or any other filter type you want to use, see help ft_preprocessing for more details
>> cfg.artfctdef.eog.bpfreq = [1 15]
>> cfg.artfctdef.eog.bpfiltord = 4; % goes hand-by-hand with the filter type; see
>>
>>
>> Take a look to the fft_artifact_eog.m documentation. To know more about
>> filtering you might want to take a look here:
>> http://www.fieldtriptoolbox.org/example/determine_the_
>> filter_characteristics
>>
>> Best,
>>
>> Diego
>>
>> On 26 October 2016 at 10:42, Maximilien Chaumon <
>> maximilien.chaumon at gmail.com> wrote:
>>
>> Dear all,
>> when attempting to detect blinks automatically on a continuous recording
>> without EOGs, I use a few frontal sensors and ft_artifact_eog as follows:
>>
>> cfg = [];
>> cfg.dataset = fullfile(rootdir,f{iD});
>> cfg.layout = 'neuromag306mag.lay';
>> cfg.trialdef.eventtype = 'STI101';
>> cfg.trialdef.eventvalue = {255};
>> cfg = ft_definetrial(cfg);
>>
>> cfg.trl = [cfg.trl(1,1) cfg.trl(end,2) 0];
>> cfg.channel = 'megmag';
>> cfg.continuous = 'yes';
>> data = ft_preprocessing(cfg);
>>
>>
>> cfg.artfctdef.eog = [];
>> cfg.artfctdef.eog.channel = eogchans;
>> cfg.artfctdef.eog.trlpadding = 0;
>> cfg.artfctdef.eog.interactive = 'yes';
>>
>> [cfg, artifact{iC,iD}] = ft_artifact_eog(cfg,data);
>>
>> This opens an interactive window in which the EOG signal is not
>> BPfiltered, and contains in particular slow drifts that make the threshold
>> detection pretty inefficient. I'm surprised because cfg.artfctdef is
>> supposed to bpfilter 1-15Hz the data, isn't it?
>>
>> Is this normal?
>> Thanks,
>> Max
>>
>>
>>
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20161026/2b8b13ee/attachment-0002.html>
More information about the fieldtrip
mailing list