본문 바로가기
Brain Engineering/EEGLAB

[EEGLAB] Independent Component Analysis

by goatlab 2022. 3. 28.
728x90
반응형
SMALL

ICA를 위한 데이터 전처리

 

1. Channel location : ICA를 돌리기 위해서는 채널 로케이션 정보를 먼저 입력해 주어야 한다.

2. Downsampling : Downsampling을 미리 하면 ICA를 더 빠르게 돌릴 수 있다.

3. Detrending : 뇌파 측정 기기 등의 영향으로 시간에 따라 뇌파 신호가 점차 강해지거나 약해지는 trending이 있을 수 있는데, 이를 ICA 전에 미리 제거해준다. detrend는 Matlab의 내장함수이기 때문에 Mathworks 공식 홈페이지 또는 Matlab 도움말을 사용해서 함수의 기능을 확인할 수 있다.

for i = 1:EEG.trials, EEG.data(:,:,i) = detrend(EEG.data(:,:,i)')'; end;
[ALLEEG EEG CURRENTSET] = eeg_store(ALLEEG, EEG);

 

ICA run

 

 

Epoch을 자르지 않고 ICA를 진행한다.

 

ICA 후 Artifact 제거

 

 

ICA를 돌린 데이터를 불러와서 Tool > Reject data using ICA > Reject components by map을 선택한다.

 

여러 데이터 처리를 위한 스크립트 생성

 

  • ICA를 모든 실험, 모든 피험자에 일일히 클릭해서 돌리지 않고, 한 번에 스크립트를 통해서 돌린다.
  • rejection은 일일히 해주어야 한다.
% parameters
% Name of the analysis
AnalyName = 'ica';

% EEG file location
EEGloc = 'D:\EEG 파일 모음\내 실험\Ex1_n2pc_tar\뇌파데이터\pp\'; 

cd(EEGloc);

% find Files
runStr = '*.set';
fileNames = dir(runStr);
foldersize = size(fileNames,1);

% sampling rate
resamplerate = 500;

% eeglab
eeglab;

% preprocessing
for file = 1:foldersize

    fprintf('\n\nprocessing file %d \n', file)  

    % 1. load EEG file
%     EEG = pop_loadcnt(fileNames(file).name , 'dataformat', 'auto', 'memmapfile', '');
%     EEG = eeg_checkset( EEG );
    EEG = pop_loadset('filename',fileNames(file).name,'filepath',EEGloc);
    EEG = eeg_checkset( EEG );

    % 2. ICA
    EEG = pop_runica(EEG, 'extended',1,'interupt','off');
    EEG = eeg_checkset( EEG );

    % 3. save
    if ~exist(AnalyName, 'dir')
        mkdir(AnalyName);
    end
    EEG = pop_saveset( EEG, 'filename',strcat(extractBefore(fileNames(file).name, "."), '_', AnalyName, '.set'),'filepath',strcat(EEGloc, AnalyName));
    EEG = eeg_checkset( EEG );
end

 

ICA를 하기 전 detrending을 해준다. Epoch은 자르지 않는다. downsampling을 미리 하면 ICA를 더 빠르게 돌릴 수 있다.

 

EOG artifact 혹은 bad electrode를 눈으로 보고 빼낸다.

microvolt 절대값으로 빼내는 법 Attentional capture by task-irrelevant fearful faces is revealed by the N2pc component

 

https://wikidocs.net/35200

 

2-2-2. ICA (Independent Component Analysis)

[TOC] ## ICA를 위한 데이터 전처리 ### Channel location * ICA를 돌리기 위해서는 채널 로케이션 정보를 먼저 입력해주어야합니다. 지금 예제에 사 ...

wikidocs.net

 

728x90
반응형
LIST

'Brain Engineering > EEGLAB' 카테고리의 다른 글

[EEGLAB] 샘플 EEGLAB 데이터세트 로드  (0) 2022.04.13
[EEGLAB] 설치 및 시작  (0) 2022.04.13
[EEGLAB] Filtering / Downsampling  (0) 2022.03.14
[EEGLAB] Channel location / Re-referencing / Detrending  (0) 2022.03.14
EEGLAB  (0) 2022.03.14