artifact rejection

Esther Meeuwissen esther.meeuwissen at FCDONDERS.RU.NL
Mon Jun 26 15:04:27 CEST 2006


Hi all,

A few weeks ago I started to work with Fieldtrip. I would like use it to 
analyze EEG data.

I have a question concerning preprocessing of EEG data. I would like to do 
a artifact rejection during preprocessing partly using the functions in 
fieldtrip (detection and rejection of  muscle artifacts) and partly 
reading in artifact markers that are exported out of brain vision analyser 
(I used the raw data inspector to detect eye blinks).

I used the following script:

EEGchans = 
{'Fp2', 'F7', 'F3', 'Fz', 'F4', 'F8', 'FC5', 'FC1', 'FCz', 'FC2', 'FC6', 'T
7', 'C3', 'Cz', 'C4', 'T8', 'CP5', 'CP1', 'CP2', 'CP6', 'TP10', 'P7', 'P3',
 'Pz', 'P4', 'P8', 'O1', 'O2'};
EOGchans = {'VB','HL', 'HR', 'VO'};

files = {'GOS10B'...
    'GOS11C'};
for subject=1:2,
   
% Parameters
cfg = [];
cfg.datafile            = strcat('',files{subject},'.eeg');
cfg.headerfile          = strcat('',files{subject},'.vhdr');
cfg.trialdef.trgfile    = strcat('',files{subject},'.vmrk');
cfg.rejectfile          = strcat('',files{subject},'_Reject.Marker');
cfg.icaresultfile       = strcat('',files{subject},'.ica');
cfg.outdatafile         = strcat('',files{subject},'.mat');

cfg.channel    = {'all'};
cfg.padding    = 1.5;
cfg.bpfilter   = 'yes';
cfg.bpfreq     = [0.3 30];
cfg.blc        = 'yes';
cfg.blcwindow  = [-0.1 0.0];

% EEG options
cfg.reref      = 'no';
cfg.implicitref = [];
cfg.refchannel  = {};

% Trial definition
cfg.trialdef.stim = [1 2 3 4];   
cfg.trialdef.prestim    = 0.200;
cfg.trialdef.poststim   = 1.000;

% Artifact options (preprocessing)
cfg.artfctdef.reject            = 'complete';
cfg.artfctdef.muscle.sgn        = EEGchans;
cfg.artfctdef.muscle.feedback   = 'no';
cfg.artfctdef.muscle.cutoff     = 15;

% Do preprocessing
cfg = definetrial(cfg);
cfg = artifact_muscle(cfg)
cfg = rejectartifact(cfg);
data = preprocessing(cfg);

%Save intermediate result
save(cfg.outdatafile,'data');
clear data;
pack;
end;

and get the following error message:

 Error using ==> horzcat
CAT arguments dimensions are not consistent.

Error in ==> rejectartifact at 182
    cfg.artfctdef.type = [{'file'} cfg.artfctdef.type];

Error in ==> preprocessing at 317
[cfg] = rejectartifact(cfg);

Error in ==> preproesther1 at 45
data = preprocessing(cfg);

By trying to make it work I figured out that it is possible to do both the 
artifact rejection parts separately using (parts of) the script above but  
(Fieldtrip wants to combine two matrices to 1 matrix and that is what goes 
wrong). Does anyone know how (/whether) it is possible to do a artifact 
detection/rejection in Fieldtrip partly using functions of Fieldtrip 
itself and partly read markers of EEG parts containing a artifact (the 
file made by brain vision analyzer)?

Thanks in advance for the answer(s)!
Esther Meeuwissen



More information about the fieldtrip mailing list