[FieldTrip] Partial artifact rejection
Ingrid Nieuwenhuis
inieuwenhuis at berkeley.edu
Wed Dec 5 19:08:52 CET 2012
Hi Patrick,
What you can do is use partial artifact rejection by calling
ft_rejectarttifact with cfg.artfctdef.reject = 'partial'. Then
subsequently loop over the trials you get, and identify the ones (by
looking at data.time{iTr}) that do not start at the time your trials
normally start (this means it's a trial after an artifact). Finally,
exclude those by using ft_redefinetrials.
For instance, if your trials start with t=0, then after
ft_rejectartifact you can do something like:
ind_keep = zeros(length(data.trial),1); %allocate
for iTrl = 1:length(data.trial)
if data.trial{iTrl}(1) ~= 0
%this means it's a trial occurring AFTER an artifact
ind_keep(iTrl) = false;
else
%this means it's a trial occurring BEFORE an artifact
ind_keep(iTrl) = true;
end
end
%only keep the trials before the artifact:
cfg = [];
cfg.trials = find(ind_keep);
data = ft_redefinetrial(cfg, data);
Hope this helps,
Ingrid
On 12/5/2012 5:57 AM, Jung, Patrick wrote:
>
> Dear all,
>
> in the reference documentation it says "In case of partial artifact
> rejection, a minimum length of the
>
> resulting sub-trials can be specified."
>
> I'd like to reject the trial segment from the beginning of the
> artifact onwards to keep only the data before the artifact occurred.
>
> But I don't want to append subtrials.
>
> How can I do that in fieldtrip?
>
> Many thanks for your help!
>
> Best,
> Patrick
>
>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
--
Ingrid Nieuwenhuis PhD
Postdoctoral Fellow
Sleep and Neuroimaging Laboratory
Department of Psychology
University of California, Berkeley
California 94720-1650
Tolman Hall, room 5305
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20121205/875a52c7/attachment-0002.html>
More information about the fieldtrip
mailing list