[FieldTrip] Exporting preprocessed data from BVA to Fieldtrip

Schoffelen, J.M. (Jan Mathijs) janmathijs.schoffelen at donders.ru.nl
Fri Sep 17 16:05:47 CEST 2021


Hi Elsa,

Have you consulted this piece of documentation?

https://www.fieldtriptoolbox.org/getting_started/brainvision/

It is not clear to me why you use a mix of low-level functionality (ft_read_data) and high level functionality (ft_definetrial), in combination with exported already epoched data to try to achieve what you want to achieve.

If you already have segmented data, why would you need to epoch your data once more (as suggested by your intention to call ft_definetrial, followed by ft_redefinetrial)?


Best wishes,
Jan-Mathijs


On 17 Sep 2021, at 15:16, Elsa Sangaran via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

Dear all,

I am having some trouble with the exported data (averages of different conditions in my experiment) which I preprocessed on Brain Vision Analyzer. I used the generic data export option on BVA, which generated 3 files (.seg, .vhdr, .vmrk), which I then imported to Fieldtrip. When reading in the exported data, I get the following error messages and warnings:

Script:
for subj = (name_subj)
    % (re)set directory to the directory that contains the trialfun
    subject = subj{:};


seg_file =[dir_raw_data_external subject '.seg'];                              %Subject's .seg file, ie. 'pilot1.seg'
header_file =[dir_raw_data_external subject '.vhdr'];                           %Subject's .vhdr file, ie. 'pilot1.vhdr'

cfg = [];
cfg.dataset = seg_file;
hdr = ft_read_header(header_file);
nTrials = hdr.nSamples/trial_length;
hdr.nTrials = nTrials;
hdr.nSamples = trial_length;
dat = ft_read_data(seg_file,'header', hdr);
cfg.label = channel_labels;
cfg.trial = squeeze(num2cell(dat,[1 2]))';
cfg.hdr = hdr;
cfg.time = repmat({[time_start:(time_end-time_start)/trial_length:time_end-(time_end-time_start)/trial_length]},1,nTrials);
cfg.label = cfg.hdr.label;
cfg.trialinfo = [];
cfg.sampleinfo = [0 300];
cfg.fsample = 250;
data_raw = cfg;

% make variables for header and eeg file
%    headerfile   = [dir_raw_data_external subject '.vhdr'];
%     segfile     = [dir_raw_data_external subject '.seg'];
%
%     cfg = [];
%     cfg.headerfile = headerfile;
%     cfg.dataset = segfile;
%     data_raw = ft_preprocessing(cfg);
%

%cfg.trialdef.eventtype  = 'string'
%cfg.trialdef.eventvalue = number, string or list with numbers or strings


   cfg = [];
   cfg.trialdef.prestim    = 0.2;
  cfg.trialdef.poststim   = 1;
  cfg.trialdef.eventtype  = 'Time 0';
    cfg.trialdef.eventvalue = '';
  cfg.trialdef.triallength = 1.2;
    cfg.trialdef.ntrials     = 1;

   cfg.headerfile  = header_file;
   cfg.datafile    = seg_file;
        cfg_deftrial = ft_definetrial(cfg);
         data_segmented = ft_redefinetrial(cfg_deftrial, data_raw);
end

For ft_definetrial, I get the following warnings:


  *   Warning: could not determine dimord of "dataset"
  *   Warning: inconsistent sampleinfo
  *   Warning: inconsistent trialinfo

For ft_redefinetrial, I get the following warnings:


  *   Warning: the data does not contain sampleinfo
  *   Warning: reconstructing sampleinfo by assuming that the trials are consecutive segments of a continuous recording


I appreciate your advice and guidance on how to go about this as I am still new to using Fieldtrip.
Thank you in advance for your help.

Best,
Elsa Sangaran
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!o3jHqkEcULy-4-Yhs1dCRLuowLpVyMM6X50Tx97RfvKIod7supWjdpMoWfsBolRXV5SvqImpEfUDv-o$

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20210917/017059c5/attachment.htm>


More information about the fieldtrip mailing list