Professional Documents
Culture Documents
(ECE2006)
Project report
Submitted by:-
S.S.NITHISH SOORYA-19BEC0212
S.TARUN - 19BEC0661
1
Artifact Removal and Denoising in EEG signal
using ICA and S-transform
SENSE
VIT University(Vellore)
Fall Semester 2021-2022
2
TABLE OF CONTENTS
3
ABSTRACT :-
INTRODUCTION:-
4
EEG :-
5
BLOCK DIAGRAM:-
METHODOLOGY:-
1) Pre-processing:
6
The frequency of EEG signals range from 4 Hz to around 45 Hz.
Use a band pass filter to pass the EEG data in this range of
frequency.
3)ARTIFACT DETECTION :
7
After finding the particular artifactual component, it will be sent to
further denoising.
4) S-TRANSFORM :
When ICs are separated from the mixture of sources some
cerebral activity is also leaked in artifactual ICs, the complete rejection
of such ICs may yield errors in the reconstruction process.
➢ Find out the mean and standard deviation of the absolute values of
S-transform coefficients P(i,j) in the selected frequency band.
8
MATLAB CODE:-
clc
close all
clear all
%plotting
Data = Data';
figure('color','w');
PlotEEG(Data, Fs);
title('EEG Data');
xlabel('Time (s)')
%ICA
[ics, A, W] = infomax(Data);
figure('color','w');
PlotEEG(ics, Fs);
title('Independent Components');
xlabel('Time (s)')
figure;
afc = inputdlg({'Artifact IC'},'Components to remove',1);
n = str2double(afc{1});
s=ics;
9
s=s(n,:);
PlotEEG(s,Fs);
grid on
title('Artifactual component');
xlabel('Time (s)')
x=s;
% Stockwell transform
ST=stran(x);
fc=16;
Wn=(2/Fs)*fc;
b=fir1(20,Wn,'low');
p=filter(b,1,ST);
%thersholdfuncton
T=mean(abs(p))+2*std(abs(p));
% multiplying factor
w=0.1;
[m,n]=size(p);
for i=1:m
for j=1:n
if(abs(p(i,j))>=T(1,j))
p(i,j)=p(i,j)*w;%thresholding
else
p(i,j)=p(i,j);
end
end
end
% inverse S-transform
IST=istran(p);
figure;
PlotEEG(IST,Fs);
title('Denoised IC');
xlabel('Time (s)')
ylabel('EEG amplitude(v)');
xlim([0.5 6]);
figure;
PlotEEG(s,Fs);
10
hold on;
PlotEEG(IST,Fs);
xlim([0.5 6]);
title('comparison plot');
legend('artifactual IC','denoised IC');
hold off;
%whitening
%decorrelating matrix
Wz = 2 * inv(sqrtm(cov(X')));
X = Wz * X;
% de-mixing matrix
W = W * Wz;
% mixing matrix
A = inv(W);
% independent signals
signals = W * mixes;
end
% S transform function
function ST=stran(h)
[~,N]=size(h);
nhaf=fix(N/2);
odvn=1;
11
if nhaf*2==N;
odvn=0;
end
f=[0:nhaf -nhaf+1-odvn:-1]/N;
Hft=fft(h);
%Gaussian filter
invfk=[1./f(2:nhaf+1)]';
W=2*pi*repmat(f,nhaf,1).*repmat(invfk,1,N);
G=exp((-W.^2)/2); %Gaussian in freq domain
%Toeplitz matrix with the shifted fft(h)
HW=toeplitz(Hft(1:nhaf+1)',Hft);
% Exclude the first row
HW=[HW(2:nhaf+1,:)];
% Compute Stockwell Transform
ST=ifft(HW.*G,[],2);
st0=mean(h)*ones(1,N);
ST=[st0;ST];
end
%Inverse S transform
function out = istran(S)
N=size(S,2);
% perform the inner sum
for ii=1:size(S,1)
ss(ii)=sum(S(ii,:));
end
% fix the sign on the imaginary part
ss_real=real(ss);
ss_imag=imag(ss);
ss_imag(1:round(N/2))=-1*ss_imag(1:round(N/2));
ss=ss_real+(1i*ss_imag);
% time-domain signal
ist=real(ifft(ss));
%time series to original length
ts=resample(ist,2,1);
out=ts;
end
12
RESULTS AND DISCUSSION:
EEG DATA:
This is the plot of the 10 channels of EEG data imported from physionet
website where the data was recorded following the International 10–20
system of electrode placement.This data is preprocessed using notch
filter to remove 50 Hz line noise and passed through high pass filter to
suppress noises appearing below 4 Hz.EEG signals were sampled at 256
Hz.
13
INDEPENDENT COMPONENTS(ICs):
14
ARTIFACTUAL IC:
DENOISED IC:
15
This is the plot of denoised IC obtained.Stockwell transform(S-transform)
is used to transform the artifactual IC to time-frequency domain where
thresholding is performed.In thresholding process the artifactual IC is
multiplied with a weight(value=0.1) to suppress the spikes.After
supressing artifacts inverse Stockwell transform is performed to
transform the denoised Ic into time domain.
COMPARISON PLOT:
16
QUANTITATIVE ANALYSIS:
17
This is the plot of Independent Components (Ics) obtained after
implementing infomax algorithm in EEGLAB.
By visual inspection we can observe component 7 is an artifactual
component since it has large spike which is basically a blink artifact.
This is the plot obtained after denoising ICs,Red denotes channels after
rejection,black denotes the channels before rejection.All the spikes are
suppressed after denoising in EEGLAB.
CONCLUSION:-
18
by quantitative evaluation analysis The proposed methodology of
artifact correction can be effectively applied for processing of
contaminated EEG data in a real time environment.
REFERENCES:
https://www.sciencedirect.com/science/article/abs/pii/S00457906163
01483
https://www.emerald.com/insight/content/doi/10.1016/j.aci.2018.08.
006/full/html#sec003
19