[Eeglablist] runing ICA excluding some channels
Sarnthein Johannes
Johannes.Sarnthein at usz.ch
Thu May 24 00:19:20 PDT 2007
Dear Maro,
1) I am wondering why you would exclude EOG channels before running ICA for artefact rejection. I use them as my best markers for EOG artefacts, so I include them in the ICA-run for artefact rejection.
2) We also record EMG on the arm. This has to be excluded before running ICA for artefact rejection. The script below gives an outline, how I run ICA on head channels only and append the arm channel in the end.
Best,
Johannes
%% uses EEGLAB scripts and suptitle.m, which is available at Matlab central
%%
[ALLEEG EEG CURRENTSET ALLCOM] = eeglab;
EEG = pop_loadcnt(filename);
[ALLEEG EEG] = eeg_store(ALLEEG, EEG, CURRENTSET);
eeglab redraw
pop_eegplot( EEG, 1, 0, 1);
pause % do visual artefact marking and rejection now
%%
[ALLEEG EEG CURRENTSET] = pop_newset(ALLEEG, EEG, CURRENTSET, 'setname', [subj.name{is},'_',condition]);
EEG = pop_saveset( EEG, [subj.name{is},'_',condition,'.set'],'');
[ALLEEG EEG] = eeg_store(ALLEEG, EEG, CURRENTSET);
visualmarked=CURRENTSET;
eeglab redraw;
%% delete all sets except for visualmarked
x=1:10;x(find(x==visualmarked))=[];
ALLEEG = pop_delset( ALLEEG, x );
eeglab redraw;
%% select channels for runica
limb=[62]; %exclude 62(limb r) & 61(if VEOG == limb left) before ICA
EEG = pop_select( EEG, 'channel',limb);
[ALLEEG EEG CURRENTSET] = pop_newset(ALLEEG, EEG, CURRENTSET, ...
'setname', 'emg','save',[subj.name{is},'_',condition,'emg.set']);
emg=EEG.data; % create emg variable to append in the end
EEG = eeg_retrieve(ALLEEG, visualmarked); CURRENTSET = visualmarked;
EEG = pop_select( EEG, 'nochannel',limb);
[ALLEEG EEG CURRENTSET] = pop_newset(ALLEEG, EEG, CURRENTSET, 'setname', 'nolimb');
eeglab redraw;
%% runica
EEG = pop_runica(EEG, 'icatype','runica');
[ALLEEG EEG] = eeg_store(ALLEEG, EEG, CURRENTSET);
% plot scrolled components
pop_eegplot( EEG, 0, 1, 1);
suptitle([subj.name{is},'_',condition,'.set'])
print % prints components automatically!!!
%% plot spectra to detect artefact components
figure; pop_spectopo(EEG, 0, [0 EEG.xmax*1000], 'EEG' , 'freq', [2.5], 'plotchan', 0, 'percent', 100, ...
'icacomps', [1:size(EEG.icaweights,1)], 'nicamaps',10, 'freqrange',[2 25],'electrodes','off');
figure; pop_spectopo(EEG, 0, [0 EEG.xmax*1000], 'EEG' , 'freq', [20], 'plotchan', 0, 'percent', 100, ...
'icacomps', [1:size(EEG.icaweights,1)], 'nicamaps',10, 'freqrange',[2 25],'electrodes','off');
%% subcomp reject artefact components
components= [5 11 47 58 1 6 7 22 23 24 40 48];
EEG = pop_subcomp( EEG, components, 1);
[ALLEEG EEG] = eeg_store(ALLEEG, EEG, CURRENTSET);
eeglab redraw;
%% saveset
[ALLEEG EEG CURRENTSET] = pop_newset(ALLEEG, EEG, CURRENTSET, 'setname', [subj.name{is},'_',condition,'ICA']);
EEG = pop_saveset( EEG, [subj.name{is},'_',condition,'ICA.set'], ['']);
[ALLEEG EEG] = eeg_store(ALLEEG, EEG, CURRENTSET);
eeglab redraw;
pop_eegplot( EEG, 1, 0, 1);
% change to edit figure
suptitle([subj.name{is},'_',condition,'ICA.set'])
%print
icacleaned=CURRENTSET;
%% append emg
EEG = eeg_retrieve(ALLEEG, icacleaned); CURRENTSET = icacleaned; % includes HEOG
EEG.data=[EEG.data; emg]; % append emg variable created above to nolimb, which was ICAcleaned
EEG.nbchan=EEG.nbchan+size(emg,1);
EEG.chanlocs=pop_chanedit(EEG.chanlocs, 'load',{ 'fms63limb1.loc', 'filetype',''});
[ALLEEG EEG CURRENTSET] = pop_newset(ALLEEG, EEG, CURRENTSET,...
'setname', [subj.name{is},'_',condition,'ICAemg'],...
'save', [subj.name{is},'_',condition,'ICAemg.set']);
eeglab redraw;
pop_eegplot( EEG, 1, 0, 1);
suptitle([subj.name{is},'_',condition,'ICAemg.set'])
% now print out channel data plot
-----Ursprüngliche Nachricht-----
Von: eeglablist-bounces at sccn.ucsd.edu [mailto:eeglablist-bounces at sccn.ucsd.edu] Im Auftrag von Maro Machizawa
Gesendet: Mittwoch, 23. Mai 2007 18:54
An: eeglablist at sccn.ucsd.edu
Betreff: [Eeglablist] runing ICA excluding some channels
Dear Colleagues,
First, I would like to run ICA (extended one) excluding a couple of channels, which are EOG bipolar channels. Because I would like to keep those channels in the same data set, I wonder if it is possible.
Secondary, if it is possible, I also need to remove some of artifactual ICs without affecting those EOG channels that were excluded from previous ICA.
If it is possible, an example of command scripts would be great help.
Best regards,
Maro
_______________________________________________
eeglablist mailing list eeglablist at sccn.ucsd.edu Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
To unsubscribe, send an empty email to eeglablist-unsubscribe at sccn.ucsd.edu
More information about the eeglablist
mailing list