artifact rejection of continuous data in fieldtrip

Matt Mollison matthew.mollison at COLORADO.EDU
Thu Mar 18 20:13:04 CET 2010


Dr. Holle,

In initially learning to use FieldTrip I set up a script to do artifact
detection/rejection on continuous data, but I have since switched to
segmented processing because, as you say, it is just easier to deal with
segmented trials.  The way I coded it is as follows, but I cannot be sure
that it is correct because I did not extensively compare continuous to
segmented preprocessing.

This does artifact detection before epoching (which is the time consuming
part, especially on continuous data), and the actual rejection occurs after
defining events.  Playing around with different epochs does not sound as
easy as you describe for EEProbe, but I think the nature of the FT data
structure prevents what you are looking for from happening (i.e., the actual
data is stored in the struct and is not just referencing a continuous file).
 If anyone has suggestions or corrections, I would like to hear them as
well.

1. Read in the continuous data.
2. Read in electrode locations.
3. Set up EOG vertical and horizontal channels and append them to the data.
4. Lowpass and line noise (DFT) filter.
5. Use eventtype = '?' and trialfun = 'trialfun_general' in ft_definetrial,
and then define 1 big trial by manually set the resulting cfg's trl field to
be [1 length(data.time{1}) 0]; then run ft_preprocessing with the cfg that
has the modified trl field.
6. Detect artifacts across the continuous data using whichever functions are
appropriate. Note: Use a unique name for the resulting cfg as it is used
later; do not reject artifacts yet.

I start a for loop here for each event type; this contains steps 7–10.

7. Use ft_definetrial with your own trialfun to get a cfg and then
ft_redefinetrial to get the data in trial format.
8. Use ft_rejectartifact with the cfg from step 6, and then ft_preprocessing
to get the trials without artifacts.
9. Finish with any remaining preprocessing (rereference, baseline
correction, etc.).
10. Store this event type in a struct, indexed by the number of event types
for this subject.

I hope that helps. Again, any improvements on this would be interesting to
hear. Maybe a FT wiki page could be made describing this process.

Matt

--
Univ. of Colorado at Boulder
Dept. of Psychology and Neuroscience
matthew.mollison at colorado.edu
http://psych.colorado.edu/~mollison/


On Thu, Mar 18, 2010 at 11:58 AM, Henning Holle <h.holle at sussex.ac.uk>wrote:

> Dear list members,
>
> I have a more general question about how continuous data is treated in
> fieldtrip. After playing around with the package for a bit, I noticed that
> although using continuous data is in principle supported, sooner or later
> one always runs into a dead-end, because most functions assume that trials
> are defined very early on in the processing tree (i.e., they don't work
> without a cfg.trl present). For instance, most artifact rejection functions
> seem to work only on epoched data.
>
> I have used EEProbe previously, and what I quite liked about that program
> was that is was possible to do artifact rejection once for the continuous
> data set, and subsequently one was free to define trials however one wanted
> to. In contrast, in fieldtrip one is forced to do a new artifact rejection
> (which is very time-consuming!), when one chooses to analyse the ERPs
> time-locked to a different event. Or am I missing something here?
>
> Is there a possibility to do an artifact rejction before the data is cut
> into epochs?
>
> Best wishes
>
> Henning
>
> --
> *************************
> Dr. Henning Holle,
> Department of Psychology,
> University of Sussex,
> Falmer, Brighton,
> BN1 9QH, U.K.
> Tel. : +44 (0)1273 877240
> Fax. : +44 (0)1273 678058
>
> ----------------------------------
> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20100318/d0e29c00/attachment-0001.html>


More information about the fieldtrip mailing list