[FieldTrip] Question about segmentation

Boukje Habets boukje.habets at uni-bielefeld.de
Thu Dec 7 10:09:56 CET 2017


Hi Stephen and Jan-Mathijs,

Thanks for your replies! I indeed did not need to add a trigger, i just didnt define the timewindow (with respect to the first trigger code) correctly before. Now its working just fine

Thanks for your help, 

Boukje

Am 05.12.17 12:12 schrieb fieldtrip-request at science.ru.nl:
> 
> Send fieldtrip mailing list submissions to
> 	fieldtrip at science.ru.nl
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> 	https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> or, via email, send a message with subject or body 'help' to
> 	fieldtrip-request at science.ru.nl
> 
> You can reach the person managing the list at
> 	fieldtrip-owner at science.ru.nl
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of fieldtrip digest..."
> 
> 
> Today's Topics:
> 
>  1. Question about segmentation (Boukje Habets)
>  2. Re: Question about segmentation (Stephen Whitmarsh)
>  3. Re: Question about segmentation (Schoffelen, J.M. (Jan Mathijs))
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Tue, 05 Dec 2017 10:55:28 +0100
> From: Boukje Habets <boukje.habets at uni-bielefeld.de>
> To: fieldtrip at science.ru.nl
> Subject: [FieldTrip] Question about segmentation
> Message-ID: <71c0e7f647c8c.5a267b20 at uni-bielefeld.de>
> Content-Type: text/plain; charset="us-ascii"
> 
> 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
> ----------------------------------------------------------------
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20171205/a2e5b190/attachment-0001.html>
> 
> ------------------------------
> 
> Message: 2
> Date: Tue, 5 Dec 2017 11:52:16 +0100
> From: Stephen Whitmarsh <stephen.whitmarsh at gmail.com>
> To: FieldTrip discussion list <fieldtrip at science.ru.nl>
> Subject: Re: [FieldTrip] Question about segmentation
> Message-ID:
> 	<CAFrxm=x11ZT4pXk+tY5jkUMEM=150feSyhWCMWhqPmzTHQ-nKA at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
> 
> 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>
> 
> ------------------------------
> 
> Message: 3
> Date: Tue, 5 Dec 2017 10:57:33 +0000
> From: "Schoffelen, J.M. (Jan Mathijs)" <jan.schoffelen at donders.ru.nl>
> To: FieldTrip discussion list <fieldtrip at science.ru.nl>
> Subject: Re: [FieldTrip] Question about segmentation
> Message-ID: <851A8ED2-B8C9-4889-A997-F34090596BE5 at donders.ru.nl>
> Content-Type: text/plain; charset="utf-8"
> 
> 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
> 
> 
> 
> 
> 
> ------------------------------
> 
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> 
> End of fieldtrip Digest, Vol 85, Issue 3
> ****************************************
> 
-- 

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
----------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20171207/1df440b1/attachment-0001.html>


More information about the fieldtrip mailing list