[FieldTrip] Partial artifact rejection

Jung, Patrick patrick.jung at esi-frankfurt.de
Thu Dec 6 09:54:57 CET 2012


Hi Ingrid,

thanks! That definitely helps a lot!

Cheers,
Patrick

From: fieldtrip-bounces at science.ru.nl [mailto:fieldtrip-bounces at science.ru.nl] On Behalf Of Ingrid Nieuwenhuis
Sent: 05 December 2012 19:09
To: fieldtrip at science.ru.nl
Subject: Re: [FieldTrip] Partial artifact rejection

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<mailto: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/20121206/63abf0dd/attachment.html>


More information about the fieldtrip mailing list