[FieldTrip] Error reading BioSemi file

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Fri Mar 15 12:47:27 CET 2019


Hi Marion,

It could be that the mex files is not working properly in your case. One option could be to try and recompile it on your local computer.
Alternatively, it could be that for the files that ‘work’ in your case, this specific section is bypassed, and just plain matlab code is used for the reading. Specifically, the value for offset might be larger than 2GB, in which case the ‘else’ will be executed, rather than the ‘if’. If you can verify that this is the case, you can also comment out the lines starting with ‘if’, ‘else’, and the final ‘end’.

Best wishes,
Jan-Mathijs



On 14 Mar 2019, at 18:25, Marion Vincent <marion.vincent at univ-lille.fr<mailto:marion.vincent at univ-lille.fr>> wrote:

Dear fieldtrip users,

I want to import my BioSemi files (.bdf format) for several subjects.
The files have the same structure (almost same length and same triggers) as they were recoded for identical exepriment protocol.

I’ve implemented the processing (time-locked and time-frequency analysis) on 1 set of data.
The code to read the bdf file work fine as my markers, channels,length of data, etc. are ok.

However, I can’t process all my subjects as some .bdf file can’t be opened.
Below is an extract of my code for reading the .bdf files.

******************************
dataset  = fullfile(path_Biosemi, 'AV-Exp2'  , 'P1.bdf');
% ** READ FILE INFO
               % read the header information and the events from the data
               hdr                 =   ft_read_header(dataset)
                % Config
                cfg= [];
                cfg.dataset         =   dataset;
               cfg.hdr=hdr;

               % **RE-REFERENCES
               cfg.reref           =   'yes';
                cfg.refchannel      =   {'EXG3', 'EXG4'} ; % electrode 131/132 // cell-array with new EEG reference channel(s), this can be 'all' for a common average reference
                cfg.refmethod       =   'avg'; % 'avg', 'median', or 'bipolar' for bipolar derivation of sequential channels (default = 'avg')
               % ** TRIAL DEFINITION
               cfg.channel=[1:128];
               event_All           =   ft_read_event(cfg.dataset);
******************************

The ft_read_header works perfectly for all my .bdf files. However, for some of them the ft_read_event does not work and returns this error :

Error in read_biosemi_bdf>readLowLevel (line 283)
  buf = read_24bit(filename, offset, numwords);

Error in read_biosemi_bdf (line 254)
      buf = readLowLevel(filename, offset, epochlength); % see below in subfunction

Error in ft_read_data (line 409)
    dat = read_biosemi_bdf(filename, hdr, begsample, endsample, chanindx);

Error in ft_read_event (line 345)
    sdata = ft_read_data(filename, 'header', hdr, 'dataformat', dataformat, 'begsample', begsample, 'endsample',
    endsample, 'chanindx', schan);


I’ve checked the .bdf files on the BioSemi sotware and they are ok. So files are not corrupted. And they were recorded with the same procedure as for files that work with fieldtrip.

I’ve tried to go deeper in the Matlab code for read_24bit function but I can’t find out the solution.
Does anyone have any idea, or already encountered this problem ?

Thanks for your help,
Marion


Marion VINCENT
Eng., PhD , CNRS Research Engineer
Tel: +33 607 59 46 76

Laboratoire SCALab UMR CNRS 9193
Université Lille 3
BP 60149
59653 Villeneuve d'Ascq Cedex
http://scalab.cnrs.fr<http://scalab.cnrs.fr/>
--------------------------------------------
L’Imaginarium / SCV-IrDIVE Equipex
99a Boulevard Descat
59200 Tourcoing
http://www.irdive.fr<http://www.irdive.fr/>/<http://www.irdive.fr/>

_______________________________________________
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/20190315/15aff650/attachment-0002.html>
-------------- next part --------------
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202


More information about the fieldtrip mailing list