data cleaning orders in EEGLAB: artifact rejection first or ICA first

32 views (last 30 days)
I'm a beginner of EEGLab. EEGlab's tutorials seggest first run artifact rejection, and then ICA ("run artifact rejection once to remove bad channels and large artifacts. Then after running ICA, you can run it again to remove smaller artifacts.").
I followed this and found that at least 1/3 data are rejeted (see the balck arrows of the following figures), no matter how conservative parameters I used in the code, see the following codes.
Therefore, I used the ICA+artifact rejection+ICA sequences, which only rejected <10% data, and the time sequence of votage sames clean (see the red arrows). However, some people may challenge it as it is not follow the official suggestions.
So I want ask whether the code 2 of ICA+ rejection+ICA is scientifically sound? or I should follow the rejection+ICA procedure but receive the 1/3 data lose? or I should change my algorithm or deeply explore parameters ?
1 Reject+ICA
eeglab;
subjectIDs = 'CT004.set';
for i=1:length(subjectIDs)
[~, name, ~] = fileparts(subjectIDs);
EEG = pop_loadset(subjectIDs); cd('Preprocess_Simplest')
EEG = pop_eegfiltnew(EEG, 'locutoff', 2, 'hicutoff', 48);
EEG = pop_resample(EEG, 125);
% Reject
EEG = pop_clean_rawdata(EEG, 'FlatlineCriterion', 'off', 'ChannelCriterion', 'off', 'LineNoiseCriterion', 'off', 'BurstCriterion', 40, 'WindowCriterion', 0.5, 'BurstRejection', 'on');
eegplot(EEG.data, 'srate', EEG.srate, 'winlength', EEG.pnts/EEG.srate, 'spacing', 100, 'eloc_file', EEG.chanlocs, 'title', 'filter+ICA+Reject', 'position', [0 0 1 1]);
drawnow; set(gcf,'WindowState','maximized');
% ICA
EEG = pop_runica(EEG, 'icatype', 'runica');
EEG = pop_iclabel(EEG, 'default');
EEG = pop_icflag(EEG, [NaN NaN; 0.9 1; 0.9 1; 0.9 1; 0.9 1; 0.9 1; 0.9 1]);
EEG = pop_subcomp(EEG, [], 0);
eegplot(EEG.data, 'srate', EEG.srate, 'winlength', EEG.pnts/EEG.srate, 'spacing', 100, 'eloc_file', EEG.chanlocs, 'title', 'filter+ICA+Reject+ICA', 'position', [0 0 1 1]);
drawnow; set(gcf,'WindowState','maximized');
end
2 ICA+reject+ICA Code
subjectIDs = 'CT004.set';
tic,mkdir('Preprocess_Simplest');
for i=1:length(subjectIDs)
[~, name, ~] = fileparts(subjectIDs{i});
EEG = pop_loadset(subjectIDs{i}); cd('Preprocess_Simplest')
EEG = pop_eegfiltnew(EEG, 'locutoff', 2, 'hicutoff', 48);
eegplot(EEG.data, 'srate', EEG.srate, 'winlength', EEG.pnts/EEG.srate, 'spacing', 100, 'eloc_file', EEG.chanlocs, 'title', 'filter', 'position', [0 0 1 1]);
drawnow; set(gcf,'WindowState','maximized'); saveas(gcf, [name '_filter.png']); pop_saveset(EEG, [name '_filter.set']);
EEG = pop_resample(EEG, 125);
% ICA1
EEG = pop_runica(EEG, 'icatype', 'runica');
EEG = pop_iclabel(EEG, 'default');
EEG = pop_icflag(EEG, [NaN NaN; 0.9 1; 0.9 1; 0.9 1; 0.9 1; 0.9 1; 0.9 1]);
EEG = pop_subcomp(EEG, [], 0);
eegplot(EEG.data, 'srate', EEG.srate, 'winlength', EEG.pnts/EEG.srate, 'spacing', 100, 'eloc_file', EEG.chanlocs, 'title', 'filter+ICA', 'position', [0 0 1 1]);
drawnow; set(gcf,'WindowState','maximized'); saveas(gcf, [name '_ICA.png']); pop_saveset(EEG, [name '_ICA.set']);
% Reject
EEG = pop_clean_rawdata(EEG, 'FlatlineCriterion', 'off', 'ChannelCriterion', 'off', 'LineNoiseCriterion', 'off', 'BurstCriterion', 40, 'WindowCriterion', 0.5, 'BurstRejection', 'on');
eegplot(EEG.data, 'srate', EEG.srate, 'winlength', EEG.pnts/EEG.srate, 'spacing', 100, 'eloc_file', EEG.chanlocs, 'title', 'filter+ICA+Reject', 'position', [0 0 1 1]);
drawnow; set(gcf,'WindowState','maximized'); saveas(gcf, [name '_ICA_Rej.png']); pop_saveset(EEG, [name '_ICA_Rej.set']);
% ICA2
EEG = pop_runica(EEG, 'icatype', 'runica');
EEG = pop_iclabel(EEG, 'default');
EEG = pop_icflag(EEG, [NaN NaN; 0.9 1; 0.9 1; 0.9 1; 0.9 1; 0.9 1; 0.9 1]);
EEG = pop_subcomp(EEG, [], 0);
eegplot(EEG.data, 'srate', EEG.srate, 'winlength', EEG.pnts/EEG.srate, 'spacing', 100, 'eloc_file', EEG.chanlocs, 'title', 'filter+ICA+Reject+ICA', 'position', [0 0 1 1]);
drawnow; set(gcf,'WindowState','maximized'); saveas(gcf, [name '_ICA_Rej_ICA.png']); pop_saveset(EEG, [name '_ICA_Rej_ICA.set']);
end

Answers (1)

Saurav
Saurav on 24 Jul 2025
Hi @荣
I understand that you want to know whether running ICA before artifact rejection in EEGLAB is scientifically sound, especially when the standard workflow causes excessive data loss.
Here is what classic EEGLAB Recommends:
  • First, reject bad channels and major artifacts (artifact rejection).
  • Next, run ICA to isolate and remove more subtle, stereotyped artifacts.
  • Optionally, perform another round of artifact rejection after ICA for residual/smaller artifacts.
EEGLAB documentation and tutorials traditionally suggest performing artifact rejection first (to remove bad channels and large, non-stereotyped artifacts), followed by ICA (Independent Component Analysis) to identify and subtract more subtle, stereotyped artifacts such as eye blinks and muscle activity. After ICA, another round of artifact rejection can be performed to catch any smaller or residual artifacts. Refer: 1. A quick tutorial on ICA artifact rejection 2. Artifact rejection and running ICA
Why this order?
  • Large, irregular artifacts and bad channels can distort ICA decomposition, making it less effective at isolating clean, biologically meaningful components. Refer: https://sccn.ucsd.edu/~arno/mypapers/delormefinal01.pdf
  • Removing these problem portions first ensures ICA produces a meaningful demixing matrix, maximizing artifact removal power while preserving brain signals.
Using ICA Before Rejection: Is It Scientifically Sound?
  • Some researchers run ICA early to subtract stereotyped (e.g., ocular, muscle) artifacts, then apply artifact rejection to the cleaned data, and may re-run ICA again for further refinement.
  • This iterative cleaning can be justified if the initial ICA is robust (i.e., the data quality is adequate for decomposition).
  • Some studies have evaluated approaches similar to this, especially when aiming to retain more data while still ensuring artifact suppression. Refer: https://pmc.ncbi.nlm.nih.gov/articles/PMC10516012/
What to Consider?
  • Recent research supports more flexible, iterative combinations of correction and rejection, allowing data retention when artifacts are not too extreme, or when artifact cleaning is performed carefully and justified by empirical validation.
  • If your data contain many large or unpredictable artifacts, or if ICA results look poor/shallow: Stick to the standard (Reject → ICA → reject) approach, even at the cost of losing more data.
In summary, for most cases, follow EEGLAB’s recommended artifact rejection before ICA. If data loss is excessive and initial ICA works well, your approach is acceptable with careful validation and clear reporting. Data quality should always be prioritized.
I hope this helps.

Categories

Find more on EEG/MEG/ECoG in Help Center and File Exchange

Products


Release

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!