[FieldTrip] Question about segmentation

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Tue Dec 5 11:57:33 CET 2017


Dear Boukje,

I don’t think that ‘adding a trigger’ is necessary. 

Instead, I think you should be able to do something like this:

start_idx = X*fsample;
end_idx = Y*fsample;

(X and Y are the intended start and end points of the data, in seconds relative to the onset of the data recording, fsample is the sampling frequency in Hz)

cfg = [];
cfg.datafile = ‘the-name-of-your-datafile’;
cfg.trl = [start_idx end_idx 0];
cfg = … (some other optional parameters to be defined here)
data =ft_preprocessing(cfg);

cfg = [];
cfg.length = 2;
data_segmented = ft_redefinetrial(cfg, data);

best wishes,
Jan-Mathijs


J.M.Schoffelen, MD PhD
Senior Researcher, VIDI-fellow - PI, language in interaction
Telephone: +31-24-3614793
Physical location: room 00.028
Donders Centre for Cognitive Neuroimaging, Nijmegen, The Netherlands







> On 5 Dec 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






More information about the fieldtrip mailing list