automatic EOG rejection

Lars Meyer lmeyer at CBS.MPG.DE
Fri Aug 7 19:25:26 CEST 2009


Hey,

I think, there was just an artifact right at the edge of the long trial (amplifier start, something like that), so artifact_eog tried to pad into a time before the trial (?). I basically added 100 to the (1,1) and substracted 100 from (1,2) of the original .trl. I know it would be better to ADD something to the original data (append some empty samples) so even these artifacts can be automatically removed, but I had to do it quick and dirty today :-)... and I know anyway that there are no real trials involved 100 samples near the edges.


Best,
Lars

Lars Meyer | MSc
Max Planck Institute for Human Cognitive & Brain Sciences
Department of Neuropsychology
Stephanstraße 1a
04103 Leipzig | Germany

Office | +49 (0)341 99 40 22 66
Fax | +49 (0)341 99 40 22 60
Mobile | +49 (0)175 113 76 65
Home | +49 (0)341 974 26 49
Mail | lmeyer at cbs.mpg.de
Web | www.cbs.mpg.de/~lmeyer

----- Ursprüngliche Mail -----
Von: "Ingrid Nieuwenhuis" <ingrid.nieuwenhuis at donders.ru.nl>
An: FIELDTRIP at NIC.SURFNET.NL
Gesendet: Freitag, 7. August 2009 17:46:41 GMT +01:00 Amsterdam/Berlin/Bern/Rom/Stockholm/Wien
Betreff: Re: [FIELDTRIP] automatic EOG rejection

My pleasure :) Did you have to do this padding manually? And did you pad the
long trial with zeros or something extending the specified trial? I can
imagine that also with one long trial you still get in trouble at the edges.
Would be nice to have a final reply and describe exactly what you did (also
useful for the archive) I'll also see if I can find a simple way to deal
with it in the code...
Best Ingrid

> -----Original Message-----
> From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On
> Behalf Of Lars Meyer
> Sent: Friday, August 07, 2009 5:22 PM
> To: FIELDTRIP at NIC.SURFNET.NL
> Subject: Re: [FIELDTRIP] automatic EOG rejection
> 
> Dear Ingrid,
> 
> thank you so much for your help today, you rescued my weekend: Padding the
> onset and offset (in samples) of the initial single trial did the trick!
> 
> 
> All best,
> Lars
> 
> Lars Meyer | MSc
> Max Planck Institute for Human Cognitive & Brain Sciences
> Department of Neuropsychology
> Stephanstraße 1a
> 04103 Leipzig | Germany
> 
> Office | +49 (0)341 99 40 22 66
> Fax | +49 (0)341 99 40 22 60
> Mobile | +49 (0)175 113 76 65
> Home | +49 (0)341 974 26 49
> Mail | lmeyer at cbs.mpg.de
> Web | www.cbs.mpg.de/~lmeyer
> 
> ----- Ursprüngliche Mail -----
> Von: "Ingrid Nieuwenhuis" <ingrid.nieuwenhuis at donders.ru.nl>
> An: FIELDTRIP at NIC.SURFNET.NL
> Gesendet: Freitag, 7. August 2009 16:20:18 GMT +01:00
> Amsterdam/Berlin/Bern/Rom/Stockholm/Wien
> Betreff: Re: [FIELDTRIP] automatic EOG rejection
> 
> Dear Lars,
> 
> Don't understand what is wrong with your data_org trial. The trl
> definition
> has 3 columns per trial: first sample of trial, last sample of trial and
> offset, did your data_org.cfg.trl have that?
> 
> Anyways you can "epoch" your data to one long single trial
> 
> trl = [1 last_sample 0]
> or use trialfun_general in definetrial with cfg.ntrials = 1; and
> cfg.triallength = inf;
> 
> Then do artifact detection/rejection and then redefine trial to real
> epochs
> based on triggers. Would that work?
> 
> Have a nice weekend too,
> Best Ingrid
> 
> > -----Original Message-----
> > From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On
> > Behalf Of Lars Meyer
> > Sent: Friday, August 07, 2009 4:00 PM
> > To: FIELDTRIP at NIC.SURFNET.NL
> > Subject: Re: [FIELDTRIP] automatic EOG rejection
> >
> > dear ingrid,
> >
> > thanks a lot, I greatly appreciate your immediate response!
> > what you suggest was what I was trying next :-). I already had suspected
> > the padding to be my problem.
> > however, 'artifact_eog' always tries to fetch 'trl' >> error:
> >
> > ??? Reference to non-existent field 'trl'.
> > Error in ==> artifact_eog at 165
> >   tmpcfg.trl              = cfg.trl;
> >
> >
> > as soon as i declare
> >
> > cfg.trl = data_org.cfg.trl
> >
> >
> > i.e. get 'trl' from the original, continuous data structure in memory
> > (data_org), matlab errors
> >
> > Input must be a row vector of characters
> >
> >
> > thanks a lot in advance, and have a good weekend,
> > lars
> >
> >
> > Lars Meyer | MSc
> > Max Planck Institute for Human Cognitive & Brain Sciences
> > Department of Neuropsychology
> > Stephanstraße 1a
> > 04103 Leipzig | Germany
> >
> > Office | +49 (0)341 99 40 22 66
> > Fax | +49 (0)341 99 40 22 60
> > Mobile | +49 (0)175 113 76 65
> > Home | +49 (0)341 974 26 49
> > Mail | lmeyer at cbs.mpg.de
> > Web | www.cbs.mpg.de/~lmeyer
> >
> > ----- Ursprüngliche Mail -----
> > Von: "Ingrid Nieuwenhuis" <ingrid.nieuwenhuis at donders.ru.nl>
> > An: FIELDTRIP at NIC.SURFNET.NL
> > Gesendet: Freitag, 7. August 2009 15:08:06 GMT +01:00
> > Amsterdam/Berlin/Bern/Rom/Stockholm/Wien
> > Betreff: Re: [FIELDTRIP] automatic EOG rejection
> >
> > Dear Lars,
> >
> > The error message means that fetch_data tries to fetch data outside of
> > your
> > trials where there is no data supplied in the input data file.
> Fetch_data
> > was recently changed and now puts NaNs where there is no data. But
> > filtering
> > data with NaNs is not a good idea, therefore the warning.
> >
> > What happens is in artifact_eog is that the data is padded, or better
> > said,
> > there is an attempt to pad the data. This is done to avoid filter
> artifact
> > at the edges, and for optimal artifact detections at/just over the
> border
> > (which can influence filtering). This padding doesn't work because in
> the
> > input data you supplied there is no extra data which can be used for
> > padding. Therefore the NaN's or the error that not all samples are
> present
> > in the data.
> >
> > Would you can do is epoch the data into trials after artifact detection.
> > So
> > first detect and reject artifacts, and then use redefinetrial (give the
> > trl
> > you have now) to epoch the data.
> >
> > Hope this helps,
> > Best Ingrid
> >
> > > -----Original Message-----
> > > From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On
> > > Behalf Of Lars Meyer
> > > Sent: Friday, August 07, 2009 2:23 PM
> > > To: FIELDTRIP at NIC.SURFNET.NL
> > > Subject: [FIELDTRIP] automatic EOG rejection
> > >
> > > dear all,
> > >
> > > (newest fieldtrip, newest matlab)
> > >
> > > trying automatic EOG artifact rejection, i get the following error:
> > >
> > > In fetch_data at 111
> > > In artifact_zvalue at 213
> > > In artifact_eog at 179
> > > Warning: data contains NaNs, no filtering applied
> > >
> > >
> > > workflow was (these all worked):
> > >
> > > - reading continous data to memory
> > > - merging EOG channels (from V+/V_ / H+/H_ to eogv and eogh)
> > > - appending EOG channels
> > > - re-refercing
> > > - filtering
> > > - epoching according to triggers
> > >
> > >
> > > while trying automatic rejection comes the error; visual rejection
> just
> > > works fine. in the olf fieldtrip version, the error message said "not
> > all
> > > samples are present in the data". i checked the data structure; the
> > merged
> > > EOG channels have been correctly appended and labelled. attached is my
> > > code, thanks a lot in advance!
> > >
> > >
> > > all best,
> > > lars
> > >
> > >
> > > Lars Meyer | MSc
> > > Max Planck Institute for Human Cognitive & Brain Sciences
> > > Department of Neuropsychology
> > > Stephanstraße 1a
> > > 04103 Leipzig | Germany
> > >
> > > Office | +49 (0)341 99 40 22 66
> > > Fax | +49 (0)341 99 40 22 60
> > > Mobile | +49 (0)175 113 76 65
> > > Home | +49 (0)341 974 26 49
> > > Mail | lmeyer at cbs.mpg.de
> > > Web | www.cbs.mpg.de/~lmeyer
> > >
> > > ----------------------------------
> > > The aim of this list is to facilitate the discussion between users of
> > the
> > > FieldTrip  toolbox, to share experiences and to discuss new ideas for
> > MEG
> > > and EEG analysis. See also
> > > http://listserv.surfnet.nl/archives/fieldtrip.html and
> > > http://www.ru.nl/neuroimaging/fieldtrip.
> >
> > ----------------------------------
> > The aim of this list is to facilitate the discussion between users of
> the
> > FieldTrip  toolbox, to share experiences and to discuss new ideas for
> MEG
> > and EEG analysis. See also
> > http://listserv.surfnet.nl/archives/fieldtrip.html and
> > http://www.ru.nl/neuroimaging/fieldtrip.
> >
> > ----------------------------------
> > The aim of this list is to facilitate the discussion between users of
> the
> > FieldTrip  toolbox, to share experiences and to discuss new ideas for
> MEG
> > and EEG analysis. See also
> > http://listserv.surfnet.nl/archives/fieldtrip.html and
> > http://www.ru.nl/neuroimaging/fieldtrip.
> 
> ----------------------------------
> The aim of this list is to facilitate the discussion between users of the
> FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG
> and EEG analysis. See also
> http://listserv.surfnet.nl/archives/fieldtrip.html and
> http://www.ru.nl/neuroimaging/fieldtrip.
> 
> ----------------------------------
> The aim of this list is to facilitate the discussion between users of the
> FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG
> and EEG analysis. See also
> http://listserv.surfnet.nl/archives/fieldtrip.html and
> http://www.ru.nl/neuroimaging/fieldtrip.

----------------------------------
The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip.

----------------------------------
The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip.



More information about the fieldtrip mailing list