Problem with brainvision files

Vladimir Litvak v.litvak at ION.UCL.AC.UK
Sat May 22 22:49:49 CEST 2010


Hi Marco,

There are two separate problems. One has to do with my mistake and one
doesn't. The problem with the example you sent me is indeed that the
data is ASCII multiplexed. I suggest that you export the data as
binary.

The second problem was introduced by my fix and I hope that it'll be
fixed if you put the attached file in fileio. I also checked it in.

Let me know if you still have problems.

Best,

Vladimir

On Sat, May 22, 2010 at 11:52 AM, Marco Rotonda <marco.rotonda at gmail.com> wrote:
> Sorry...
> I maybe you could have a better idea with the errors ;-)
>
>>> dbstop if error
>>> cfg=[];
> cfg.dataset='L001_AVG_FeedNegBL1.vhdr';
> data=ft_preprocessing(cfg);
> Warning: cannot determine number of samples for this
> sub-fileformat
>> In fileio\private\read_brainvision_vhdr at 95
>  In ft_read_header at 367
>  In ft_preprocessing at 294
> processing channel { 'F7' 'F3' 'Fz' 'F4' 'F8' 'FT7' 'FC3' 'FCz' 'FC4'
> 'FT8' 'T3' 'C3' 'Cz' 'C4' 'T4' 'TP7' 'CP3' 'CPz' 'CP4' 'TP8' 'T5' 'P3'
> 'Pz' 'P4' 'T6' 'O1' 'Oz' 'O2' }
> reading and preprocessing
> reading and preprocessing trial 1 from 1
> Warning: could not open L001_AVG_FeedNegBL1.eeg
>> In fileio\private\filetype_check_header at 44
>  In ft_filetype at 390
>  In ft_read_data at 205
>  In ft_preprocessing at 466
> Warning: could not open L001_AVG_FeedNegBL1.eeg
>> In fileio\private\filetype_check_header at 44
>  In ft_filetype at 395
>  In ft_read_data at 205
>  In ft_preprocessing at 466
> ??? Error using ==> zeros
> NaN and Inf not allowed.
>
> Error in ==> read_brainvision_eeg at 76
>  dat = zeros(endsample-begsample+1,
>  hdr.NumberOfChannels);
>
> Error in ==> ft_read_data at 442
>    dat = read_brainvision_eeg(filename, hdr.orig,
>    begsample, endsample);
>
> Error in ==> ft_preprocessing at 466
>      dat = ft_read_data(cfg.datafile, 'header', hdr,
>      'begsample', begsample, 'endsample', endsample,
>      'chanindx', rawindx, 'checkboundary',
>      strcmp(cfg.continuous, 'no'), 'dataformat',
>      cfg.dataformat)
> 76    dat = zeros(endsample-begsample+1, hdr.NumberOfChannels);
> K>> read_brainvision_eeg
> ??? Input argument "hdr" is undefined.
>
> Error in ==> read_brainvision_eeg at 32
> if strcmpi(hdr.DataFormat, 'binary') && strcmpi(hdr.DataOrientation,
> 'multiplexed') && strcmpi(hdr.BinaryFormat, 'int_16')
>
> 32  if strcmpi(hdr.DataFormat, 'binary') &&
> strcmpi(hdr.DataOrientation, 'multiplexed') &&
> strcmpi(hdr.BinaryFormat, 'int_16')
> K>>
>
>
> Maybe the problem is about the multiplexed so the way I exported the data?
>
>
>
> 2010/5/21 Vladimir Litvak <v.litvak at ion.ucl.ac.uk>:
>>  Hi Marco,
>>
>> I've done some changes recently trying to improve the recognition of
>> Brainvision files. These might or might not be related to your
>> problem. Could you perhaps do:
>>
>> dbstop if error
>>
>> and try to get some idea about why the error in filetype_check_header
>> happens. There is some problem with opening the .eeg file but it's not
>> clear what it is. I tried to use code similar to yours on a different
>> brainvision dataset and there is no problem so it may be something
>> that happens on your system for some reason. If you can't figure it
>> out, send me an example dataset via yousendit.com and I'll try to look
>> at it.
>>
>> Best,
>>
>> Vladimir
>>
>> On Fri, May 21, 2010 at 12:21 PM, Marco Rotonda <marco.rotonda at gmail.com> wrote:
>>> Hi fildtrippers!
>>> After I've updated fieldtrip I got some problems reading brainvision files I didn't
>>> got before.
>>>
>>> Here are the errors (the only differences in this script are ft_definetrial and
>>> ft_preprocessing that before were only definetrial and preprocessing):
>>>
>>> cfg=[];
>>> cfg.dataset='L001_Artifact_Rejection_FeedPos_Bl_1.vhdr';
>>> cfg.trialdef.eventtype='Stimulus';
>>> cfg.trialdef.eventvalue='S 55';
>>> cfg.trialdef.prestim=2;
>>> cfg.trialdef.poststim=1.999;
>>> cfg=ft_definetrial(cfg);
>>> data=ft_preprocessing(cfg);
>>>
>>> Warning: no trialfun was specified, using
>>> trialfun_general
>>>> In ft_definetrial at 95
>>> evaluating trialfunction 'trialfun_general'
>>> reading the events from 'L001_Artifact_Rejection_FeedPos_Bl_1.vhdr'
>>> found 256 events
>>> created 41 trials
>>> processing channel
>>> { 'X1' 'X2' 'F7' 'F3' 'Fz' 'F4' 'F8' 'FT7' 'FC3' 'FCz' 'FC4' 'FT8' 'T3' 'C3' 'Cz' 'C4' 'T4' '
>>> TP7' 'CP3' 'CPz' 'CP4' 'TP8' 'T5' 'P3' 'Pz' 'P4' 'T6' 'O1' 'Oz' 'O2' }
>>> reading and preprocessing
>>> reading and preprocessing trial 1 from 41
>>> Warning: could not open
>>> L001_Artifact_Rejection_FeedPos_Bl_1.eeg
>>>> In fileio\private\filetype_check_header at 44
>>>  In ft_filetype at 390
>>>  In ft_read_data at 205
>>>  In ft_preprocessing at 466
>>> Warning: could not open
>>> L001_Artifact_Rejection_FeedPos_Bl_1.eeg
>>>> In fileio\private\filetype_check_header at 44
>>>  In ft_filetype at 395
>>>  In ft_read_data at 205
>>>  In ft_preprocessing at 466
>>> ??? Error using ==> fseek
>>> Invalid file identifier.  Use fopen to generate a valid
>>> file identifier.
>>>
>>> Error in ==> read_brainvision_eeg at 52
>>>  fseek(fid, hdr.NumberOfChannels*4*(begsample-1),
>>>  'cof');
>>>
>>> Error in ==> ft_read_data at 442
>>>    dat = read_brainvision_eeg(filename, hdr.orig,
>>>    begsample, endsample);
>>>
>>> Error in ==> ft_preprocessing at 466
>>>      dat = ft_read_data(cfg.datafile, 'header', hdr,
>>>      'begsample', begsample, 'endsample', endsample,
>>>      'chanindx', rawindx, 'checkboundary',
>>>      strcmp(cfg.continuous, 'no'), 'dataformat',
>>>      cfg.dataformat)
>>>
>>>
>>> If I'm trying to use another file that is an average (so no trial to select) and I
>>> treat as a continous file I got these other problems:
>>>
>>> cfg=[];
>>> cfg.dataset='L001_AVG_FeedNegBL1.vhdr';
>>> data=ft_preprocessing(cfg);
>>> Warning: cannot determine number of samples for this
>>> sub-fileformat
>>>> In fileio\private\read_brainvision_vhdr at 95
>>>  In ft_read_header at 367
>>>  In ft_preprocessing at 294
>>> processing channel
>>> { 'F7' 'F3' 'Fz' 'F4' 'F8' 'FT7' 'FC3' 'FCz' 'FC4' 'FT8' 'T3' 'C3' 'Cz' 'C4' 'T4' 'TP7' 'CP3
>>> ' 'CPz' 'CP4' 'TP8' 'T5' 'P3' 'Pz' 'P4' 'T6' 'O1' 'Oz' 'O2' }
>>> reading and preprocessing
>>> reading and preprocessing trial 1 from 1
>>> Warning: could not open L001_AVG_FeedNegBL1.eeg
>>>> In fileio\private\filetype_check_header at 44
>>>  In ft_filetype at 390
>>>  In ft_read_data at 205
>>>  In ft_preprocessing at 466
>>> Warning: could not open L001_AVG_FeedNegBL1.eeg
>>>> In fileio\private\filetype_check_header at 44
>>>  In ft_filetype at 395
>>>  In ft_read_data at 205
>>>  In ft_preprocessing at 466
>>> ??? Error using ==> zeros
>>> NaN and Inf not allowed.
>>>
>>> Error in ==> read_brainvision_eeg at 76
>>>  dat = zeros(endsample-begsample+1,
>>>  hdr.NumberOfChannels);
>>>
>>> Error in ==> ft_read_data at 442
>>>    dat = read_brainvision_eeg(filename, hdr.orig,
>>>    begsample, endsample);
>>>
>>> Error in ==> ft_preprocessing at 466
>>>      dat = ft_read_data(cfg.datafile, 'header', hdr,
>>>      'begsample', begsample, 'endsample', endsample,
>>>      'chanindx', rawindx, 'checkboundary',
>>>      strcmp(cfg.continuous, 'no'), 'dataformat',
>>>      cfg.dataformat)
>>>
>>> do I miss something?
>>>
>>> regards
>>>
>>> Marco
>>>
>>> ----------------------------------
>>> The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip.
>>>
>>>
>>
>> ----------------------------------
>> The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip.
>>
>
> ----------------------------------
> The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip.
>
>

----------------------------------
The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ft_filetype.m
Type: application/octet-stream
Size: 41199 bytes
Desc: not available
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20100522/2bfbdab7/attachment-0002.obj>


More information about the fieldtrip mailing list