[FieldTrip] Question about segmentation
stephen.whitmarsh at gmail.com
Tue Dec 5 11:52:16 CET 2017
Your question is not totally clear to me, so apologies if this is not what
you mean. I gather that you want to segment your data into non-overlapping
2-sec intervals, starting at a single trigger in your data?
In any case, everything is possible, it just relies on understanding of the
trl structure (always defined in samplenumbers) and the use of
ft_preprocessing (in your case to read data and replace samples into a
time-axis) and ft_redefinetrial (can be done afterwards)
It you only want to segment your data into non-overlapping 2-sec intervals
you could do something like this:
1. Use ft_preprocessing to read all your data as one long trial relative
to your first trigger. For this you will need to enter a .trl field that
has a single row with start, end, and offset in samplenr. You can get the
sample number of your trigger (as well as the (relative) beginning and end
sample numbers) using ft_read_events. The output of ft_preprocessing will
give you a single trial defined in time around your trigger.
2. You can then use ft_redefinetrial to segment the data into short
(non-overlapping) segments. Check it's help for details. But realize you
will now define segments in terms of time, not samples.
The benefit of this order of things is that in the first preprocessing step
you can do things like filtering on the whole dataset, if you can spare the
Hope this helps,
On 5 December 2017 at 10:55, Boukje Habets <boukje.habets at uni-bielefeld.de>
> Dear Fieldtrippers,
> Im new to Fieldtrip and have a question about segmentation. I want to do a
> freqanalysis on EEG data (Brainvision Recorder).
> I have one file per condition (so only containing one trigger code, and a
> start code at the beginning of the file) that i want to segment into 2sec
> pieces. Ive been trying to find a way to add a trigger with Fieldtrip, so
> that I can segment around a new trigger. Using a pre- and poststim
> timewindow around the trigger code is not a solution, as this gives me
> overlapping segments, which i do not want.
> This doesnt seem possible?
> After reading about cfg.trialfun, I saw that i can segment a continuous
> file into segments that i can define in terms of length (sec/samples). I
> guess this is the easiest way for me to segment my file. However, i want to
> be able to define the start and end point of segmentation, as my file
> contains a part in the beginning without codes (EEG was being recorded, but
> experiment was running yet). I have been playing around with the commands
> begsample and endsample, but that didnt change the window of segmentation
> (meaning it always segments my whole file, giving me 'empty' segments).
> Does anybody know how to solve this?
> Thanks for your time,
> Boukje Habets
> Dr. Boukje Habets
> Biopsychology & Cognitive Neuroscience (AE14)
> Faculty of Psychology and Sports Science | Bielefeld University
> PO-Box 100131 | D-33501 Bielefeld, Germany
> Phone: (49) 521 - 106 67 533 | Fax: (49) 521 - 106 15 67 530
> Office: UHG T3-250
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fieldtrip