[FieldTrip] Problems with ft_appendata - merging datasets

"Jörn M. Horschig" jm.horschig at donders.ru.nl
Tue Jul 10 12:20:35 CEST 2012


Dear Sascha,

What you do is perfectly fine, but what you want is not possible in 
FieldTrip (yet?). FieldTrip is designed such that triggers (and all 
other events) are stored with respect to sample number from the 
beginning of the recording, i.e. datafile on disk. However, when you 
merge datasets, FieldTrip cannot infer to what dataset a specific sample 
number belongs - in your case it could be coming from 4 different 
datasets - and thus dismisses this information completely.

So, what you would need to as a workaround is to save the events with 
respect to your trials of interest (and dataset), and after merging, 
create a fake sampleinfo and event structure. Then, you would need to 
create events with samples respective to the fake sampleinfo. This is a 
somewhat tedious work, and only a hack to get what you want, but it's 
the only way so far :) But be aware that this work might result in a lot 
of nasty errors if you are not careful enough.

If you do not know what I mean, feel free to send me a mail and I can 
try my best to explain what I mean with a short example script.

Best,
Jörn

On 7/9/2012 3:56 PM, styll at med.ovgu.de wrote:
> Hello,
>
> I probably have a problem with the use of ft_appendata. I want to merge 4
> MEG datasets (i.e. 4 runs, all the same number of channels, sampling rate,
> etc.) of the same subject after I defined my trials of interest and
> preprocessed the 4 datasets individually. If I use ft_databrowser for a
> look into every single dataset, all trials (10 in each run/dataset) seems
> to be OK with the correct sequence: defined prestim time range, trigger
> and poststim time range. If I check the merged dataset I can go through
> all of the 40 trials, but there is no sequence like: prestim time range,
> trigger and poststim-time.  Here is my pipeline for the first steps:
>
> %%%% run1
> cfg.dataset='…\train01_64\run1\c,rfDC';
> cfg.trialdef.prestim=1;      %%% in sec
> cfg.trialdef.poststim=5;     %%% in sec
> cfg.trialfun = 'traildef_train01_all_pics_run1';
> data_run1 = ft_definetrial(cfg)
>
> cfg.channel    = {'MEG'};
> cfg.dftfilter='yes';
> prepro_run_1 = ft_preprocessing(cfg)
>
> %%%% run2
> cfg.dataset='…\train01_64\run2\c,rfDC';
> cfg.trialdef.prestim=1;      %%% in sec
> cfg.trialdef.poststim=5;     %%% in sec
> cfg.trialfun = 'traildef_train01_all_pics_run2';
> data_run1 = ft_definetrial(cfg)
>
> cfg.channel    = {'MEG'};
> cfg.dftfilter='yes';
> prepro_run_2 = ft_preprocessing(cfg)
>
> the same for run3 and run4
>
> %%%% merging the data
>
> cfg=[];
> merged_data = ft_appenddata(cfg, prepro_run_1, prepro_run_2, prepro_run_3,
> prepro_run_4)
>
> Do I miss something or is there in error in my pipeline or in my strategy…
>
> Best regards
>
> Sascha
>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip


-- 
Jörn M. Horschig
PhD Student
Donders Institute for Brain, Cognition and Behaviour
Centre for Cognitive Neuroimaging
Radboud University Nijmegen
Neuronal Oscillations Group

P.O. Box 9101
NL-6500 HB Nijmegen
The Netherlands

Contact:
E-Mail: jm.horschig at donders.ru.nl
Tel:    +31-(0)24-36-68493
Web: http://www.ru.nl/donders

Visiting address:
Trigon, room 2.30
Kapittelweg 29
NL-6525 EN Nijmegen
The Netherlands




More information about the fieldtrip mailing list