[FieldTrip] Exporting preprocessed data from BVA to Fieldtrip

Elsa Sangaran elsangaran at gmail.com
Mon Sep 20 17:53:12 CEST 2021


Dear Jan,

Thanks for your suggestions!

Yes, I have consulted the Fieldtrip website before to find out how to
export the data. What I used initially for the filename for output was the
'.seg' extension as mentioned in the website. However, another Fieldtrip
user who faced a similar problem as mine, suggested using '.dat'  extension
instead, and this solved the issue that I was having when exporting the
data from BVA (I don't get the warning/error messages anymore).

Thanks for the comments regarding the segmented data - this was helpful!
The modified script that I am now using which was provided by another
Fieldtrip user (thanks Eva!) to read in the segmented data, seems to work
well. I used ft_definetrial instead of both the ft_read_data and
ft_define_trial and  removed the ft_redefinetrial.

Best,
Elsa Sangaran


On Fri, 17 Sept 2021 at 16:45, Schoffelen, J.M. (Jan Mathijs) via fieldtrip
<fieldtrip at science.ru.nl> wrote:

> 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> 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$
>
>
> _______________________________________________
> fieldtrip mailing list
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> https://doi.org/10.1371/journal.pcbi.1002202
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20210920/c121934f/attachment.htm>


More information about the fieldtrip mailing list