[FieldTrip] Error reading BioSemi file

Marion Vincent marion.vincent at univ-lille.fr
Thu Mar 14 18:25:09 CET 2019


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
--------------------------------------------
L’Imaginarium / SCV-IrDIVE Equipex
99a Boulevard Descat
59200 Tourcoing
http://www.irdive.fr/

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