[FieldTrip] Question about segmentation

Stephen Whitmarsh stephen.whitmarsh at gmail.com
Tue Dec 5 11:52:16 CET 2017


Hi Boukje,

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
RAM.

Hope this helps,
Stephen





<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

On 5 December 2017 at 10:55, Boukje Habets <boukje.habets at uni-bielefeld.de>
wrote:

> 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
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20171205/121398ca/attachment-0001.html>


More information about the fieldtrip mailing list