[FieldTrip] FT_REJECTARTIFACT

Eelke Spaak eelke.spaak at donders.ru.nl
Wed Aug 22 20:17:29 CEST 2012


Dear Nenad,

My guess is you are missing the first argument in your call to
ft_rejectartifact; i.e. instead of

  data_no_artifacts = ft_rejectartifact(data1)

you should use

  data_no_artifacts = ft_rejectartifact(cfg, data1)

Does that work?

Best,
Eelke

On 22 August 2012 19:59, Nenad Polomac <polomacnenad at gmail.com> wrote:
> Dear all,
>
> I have one problem concerning ft_rejectartifact function.
> I did everything as you explained in automatic artifact rejection tutorial.
> I mark segments first and that is fine, but the ft_rejectartifact doesn't
> remove marked bad segments form my data.
> Please help!
>
> Here is my code:
>
> % automatic
> clear all
>
> s=[87 209 195 225 60];
>
>
> for g=1:length(s)
>     input_no=s(g)
>
>     clear sub
>
>     sub=['Subject' num2str(input_no)];
>     eval(sub)   %calling subject's script
>
>
>             cfg=[];
>             cfg.trialdef.eventtype  = 'UPPT001';
>             cfg.trialdef.eventvalue = 1;
>             cfg.trialdef.prestim    = 0.1;
>             cfg.trialdef.poststim   = 0.5;
>             cfg.trialfun = 'trialfun_general';
>             cfg.channel = {'MEG'};
>             cfg.continuous = 'yes';
>             cfg.dataset = [subjectdata.wr11.datadir];
>
>             [data1]=ft_definetrial(cfg)
>             trial=data1.trl;
>
>
>             % muscle
>             cfg=[];
>             cfg.trl =trial;
>             cfg.datafile   = [subjectdata.wr11.datafile];
>             cfg.headerfile =[subjectdata.wr11.headerfile];
>             cfg.continuous = 'yes';
>
>             % channel selection, cutoff and padding
>             cfg.artfctdef.zvalue.channel = 'MRT*';
>             cfg.artfctdef.zvalue.cutoff      = 15;
>             cfg.artfctdef.zvalue.trlpadding  = 0.5;
>             cfg.artfctdef.zvalue.fltpadding  = 0.5;
>             cfg.artfctdef.zvalue.artpadding  = 0.1;
>
>             % algorithmic parameters
>             cfg.artfctdef.zvalue.bpfilter    = 'yes';
>             cfg.artfctdef.zvalue.bpfreq      = [110 140];
>             cfg.artfctdef.zvalue.bpfiltord   = 9;
>             cfg.artfctdef.zvalue.bpfilttype  = 'but';
>             cfg.artfctdef.zvalue.hilbert     = 'yes';
>             cfg.artfctdef.zvalue.boxcar      = 0.2;
>
>             %make the process interactive
>             cfg.artfctdef.zvalue.interactive = 'yes';
>
>             [cfg, artifact_muscle] = ft_artifact_zvalue(cfg)
>
>
>
>             % jump
>             cfg=[];
>             cfg.trl =  trial;
>             cfg.datafile   = [subjectdata.wr11.datafile];
>             cfg.headerfile =[subjectdata.wr11.headerfile];
>             cfg.continuous = 'yes';
>
>             % channel selection, cutoff and padding
>             cfg.artfctdef.zvalue.channel    = 'MEG';
>             cfg.artfctdef.zvalue.cutoff     = 20;
>             cfg.artfctdef.zvalue.trlpadding = 0;
>             cfg.artfctdef.zvalue.artpadding = 0;
>             cfg.artfctdef.zvalue.fltpadding = 0;
>
>             % algorithmic parameters
>             cfg.artfctdef.zvalue.cumulative    = 'yes';
>             cfg.artfctdef.zvalue.medianfilter  = 'yes';
>             cfg.artfctdef.zvalue.medianfiltord = 9;
>             cfg.artfctdef.zvalue.absdiff       = 'yes';
>
>             % make the process interactive
>             cfg.artfctdef.zvalue.interactive = 'yes';
>
>             [cfg, artifact_jump] = ft_artifact_zvalue(cfg)
>
>
>
>
>             cfg.artfctdef.reject = 'complete';
>             cfg.artfctdef.jump.artifact = artifact_jump;
>             cfg.artfctdef.muscle.artifact = artifact_muscle;
>             data_no_artifacts = ft_rejectartifact(data1)
>  end
>
> Thank you in advance!
> NP
>
>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip



More information about the fieldtrip mailing list