Back to the main page.

Bug 547 - Neuroscan eeg file downloads problem

Status CLOSED FIXED
Reported 2011-03-24 22:35:00 +0100
Modified 2011-05-05 21:24:36 +0200
Product: FieldTrip
Component: preproc
Version: unspecified
Hardware: All
Operating System: All
Importance: P1 normal
Assigned to: Robert Oostenveld
URL:
Tags:
Depends on:
Blocks:
See also:

Olga - 2011-03-24 22:35:37 +0100

The problem is really strange, ‘cause it affects only about 10 files out of 100 of the eeg files I have. Probably it has something to do with the number of rejected trails… I think the problem is in the decoding eeg ns system (int32) in the read_ns_eeg.m line 72 it is elseif (floor(sample_size)==4) right now, but in some of my files it might be 5, 7 or even 9. So when I changed this line into elseif (floor(sample_size)>=4) the problem disappeared. I checked how the files look like after such trick, and it seems to me that everything is perfectly fine with such transformation. The data looks identical to what I have in neuroscan. So originally the bug appears when I run my script innameend = '.eeg'; path_input = 'D:\CONSTANTINO\With_OAR\Filter01_55\EEG\MMN2\ARJ\'; path_output = 'C:\Matlab_programs\Fieldtrip\My_Fieldtrip\HindiData\epoched\'; %subjects who has problems with standard loading subnames = { '90131' }; for s = 1:length(subnames(:,1)), cfg = []; sbj = char(subnames (s,:)); FILENAME_INPUT = [path_input, sbj, '_mmn2_c_bl.eeg'] cfg.dataset = FILENAME_INPUT; cfg.trialdef.eventtype = 'trial'; [cfg] = ft_definetrial(cfg); %%% separate stimuli types for i=1:length(cfg.trl(:,4)) if cfg.trl(i,4)==2 cfg.trl(i-1,5) = 3; %std before the dvn cfg.trl(i+1,5) = 4; %std after the dvn cfg.trl(i,5) = 2; else cfg.trl(i,5) = cfg.trl(i,4) ; end; end; cfg.bpfilter = 'yes'; % apply lowpass filter cfg.bpfreq = [1:30]; % lowpass at 35 Hz. FILENAME_OUTPUT = [path_output, sbj, '.mat']; cfg.outputfile = FILENAME_OUTPUT'; [data] = ft_preprocessing(cfg); end; And it says ??? Attempt to reference field of non-structure array. Error in ==> trialfun_general at 117 for i=find(strcmp(cfg.trialdef.eventtype, {event.type})) Error in ==> ft_definetrial at 128 [trl, event] = feval(cfg.trialfun, cfg); Error in ==> S1_loaddata_bugzilla at 21 [cfg] = ft_definetrial(cfg); I also attached two eeg files. One problematic and one for which the original scripts works. Best Regards, Olga. P.S. The problem I could not solve is how to load all the trails, including those, marked rejected in Neuroscan to Fieldtrip. The file I attached should contains both rejected and accccepted trails, but by some reasons only accepted is seen in the loaded variable.


Robert Oostenveld - 2011-04-15 09:46:12 +0200

I added the following elseif floor(sample_size)>4 % although this is not to be expected, it might be due to a very large "footer" compared to the data size % Olga Sysoeva reported that this extention to the datatype detection fixed it for her (see http://bugzilla.fcdonders.nl/show_bug.cgi?id=547) datatype ='int32'; epoch_size = eeg.nchan*eeg.npnt*4 + 13; end The fixed file will be part of the fieldtrip release this evening


Jan-Mathijs Schoffelen - 2011-04-22 21:07:13 +0200

*** Bug 514 has been marked as a duplicate of this bug. ***


Robert Oostenveld - 2011-05-05 21:24:36 +0200

bulk action: closed all bugs with status "resolved/fixed"