본문 바로가기
Brain Engineering/MNE

Preprocessing : Choosing a Reference

by goatlab 2022. 4. 5.
728x90
반응형
SMALL

Choosing a Reference

 

EEG 기록은 뇌의 일부와 기준점 사이의 전압차를 측정하여 수집된다. 데이터를 수집한 후 참조를 변경할 수 있으며 이 과정을 재참조라고 한다. 기준이 변경되면 채널의 신호 진폭도 달라진다. 따라서 참조는 EEG 데이터에 매우 중요합니다. 재참조는 다음과 같이 공식화할 수 있다.

 

채널 'x'의 새로운 전위 = 채널 'x'의 전위 + 원래 기준의 전위 - 새 기준의 전위

 

(참고 : 'x'는 채널 ID에 해당)

 

Selecting the reference

 

참조를 선택하기 위한 최적의 전략은 없지만 일반적으로 적용되는 몇 가지 접근 방식이 있다. 한 가지 방법은 모든 채널에서 전위의 평균을 계산하고 이 평균 전위를 기준으로 사용하는 것이다. 새 참조는 기존 채널일 필요는 없으며 가상 채널도 될 수 있다. 각 채널의 전위에서 평균 전위를 빼면 재참조가 완료된다. 또 다른 접근 방식은 귀와 같이 전기적 활동이 가장 낮은 채널을 선택하는 것이다.

 

위의 일반적으로 사용되는 접근 방식 외에도 가장 잘 수행되는 참조를 선택하는 몇 가지 통계적 접근 방식이 있다 (https://doi.org/10.1016/j.jneumeth.2014.05.008).

 

# For elimiating warnings
from warnings import simplefilter
# ignore all future warnings
simplefilter(action='ignore', category=FutureWarning)

import mne
import mne.viz
%matplotlib inline

#Load epoched data
data_file = '../datasets/817_1_PDDys_ODDBALL_Clean_curated-epo'

# Read the EEG epochs:
epochs = mne.read_epochs(data_file + '.fif', verbose='error')

# ERP plot before re-referencing
epochs.average().plot()

 

재참조를 위해 MNE 패키지에서 set_eeg_reference()라는 함수를 제공한다. epoch, evoked 또는 raw 객체로 호출할 수 있다. 새 참조 채널 또는 '평균'을 매개변수로 사용한다. 기존 채널 이름이 제공되면 해당 채널을 새 참조로 직접 사용한다. 그렇지 않으면 평균 전위를 계산하여 새 기준으로 사용한다. 이 함수는 원본 개체를 수정한다. 따라서 수정 없이 원본 개체를 유지하려면 원본 개체의 전체 복사본을 사용하면 된다.

 

import copy
# create two copies of original epochs object for further comparison
original_1 = copy.deepcopy(epochs)
original_2 = copy.deepcopy(epochs)

# Re-reference by averaging
re_ref_epochs = original_1.set_eeg_reference('average', projection=True)

re_ref_epochs.average().plot()

 

평균화하여 다시 참조한 후 플롯은 전혀 변경되지 않는다. 그 이유는 데이터가 로드될 때 데이터에 이미 평균 참조가 있기 때문입니다. 데이터 세트의 문서에는 참조와 관련된 정보가 포함되어 있다.

기존 채널을 새 참조로 사용하려면 채널 이름을 set_eeg_reference 함수에 매개변수로 전달한다. epochs.ch_names를 호출하여 채널 이름 목록을 찾을 수 있다.

 

# Set a channel as the new reference
re_ref_epochs_2 = original_2.set_eeg_reference(['TP8'])
re_ref_epochs_2.average().plot()

 

채널 TP8을 기준 전극으로 사용하면 파형이 크게 변경되었다.

아래 도표는 표준 이벤트 및 대상 이벤트에 대한 ERP 값을 보여준다. 두 플롯의 차이점은 기준 채널의 선택이다.

 

from matplotlib import pyplot as plt
%matplotlib inline

references = ['original', 'TP8']

#Data with original reference
st = epochs['Standard']
nv = epochs['Novel']

#Data with TP8 as the reference channel
st_2 = original_2['Standard']
nv_2 = original_2['Novel']
ch = 18 # channel index

for i in range(len(references)):
    fig, ax = plt.subplots(figsize=(10, 5))
    ax.set_xlabel('Time Instances')
    ax.set_ylabel('Volt') 
    if references[i] == 'original': 
        plt.title('ERP values of novel and standard conditions with original reference')
        ax.plot(st.average().data[ch,:], color='blue')
        ax.plot(nv.average().data[ch,:], color='red')
    
    else:
        plt.title('ERP values of novel and standard conditions with TP8 channel as reference')
        ax.plot(st_2.average().data[ch,:], color='blue')
        ax.plot(nv_2.average().data[ch,:], color='red')

    plt.show()

 

위의 플롯에서 볼 수 있듯이 기준이 변경되면 응답의 차이가 크게 감소한다. 대부분의 경우 뇌파 분석의 목적은 다양한 조건 간의 변화를 식별하는 것이다. 따라서 잘못된 참조 선택은 이러한 차이를 포착할 수 없는 상황으로 이어질 수 있다. 따라서 참조 선택은 뇌파 분석 중 중요한 단계 중 하나이다.

 

Effects of Re-referencing on Topography

 

다음 지형 그래프는 에포크된 원본 데이터를 사용하여 생성된다.

 

import numpy as np 
%matplotlib inline
times = np.arange(-0.1, 0.5, 0.1)
epochs.average().plot_topomap(times, ch_type='eeg')

 

채널 TP8을 다시 참조한 후 색상이 변경되는 것을 볼 수 있으므로 채널의 값이 변경된다. 그러나 채널 간의 상대적인 차이는 동일하게 유지된다. 따라서 기준 채널의 변화가 지형에 영향을 미치지 않는다는 결론을 내릴 수 있다.

 

re_ref_epochs_2.average().plot_topomap(times, ch_type='eeg')

 

https://neuro.inf.unibe.ch/AlgorithmsNeuroscience/Tutorial_files/ReferencingforEEGdata.html

 

Choosing a Reference

Choosing a Reference Tutorial #3: Referencing EEG Data This tutorial is about effects of reference selection on EEG data.Referencing: EEG recordin...

neuro.inf.unibe.ch

 

728x90
반응형
LIST