Sie sind auf Seite 1von 35

Sudan University Of Science And Technology

Biomedical Engineering Department

Presentation About :

Electroencephalography (EEG)
Prepared by:
Hamida Tharwat
Doaa Mohamed
Reham Alhadi
Mihad Modather
Saraa Ali
Afraa Eltyeb
Leena Gamal
Introduction :

The Electroencephalography(EEG) :

non-invasive technique in which the electrical activity of the brain is


recorded from the scalp by means of electrodes.
The number of electrodes used can range from 32to 256.
The resulting encephalogram presents the changes in electrical activity
as a function of time.
EEG Rhythms and Waveforms:

Delta rhythm, <4 Hz. The delta rhythm is typically encountered during
deep sleep and has a large amplitude. It is usually not observed in the
awake, normal adult, but is indicative of, e.g., cerebral damage or brain
disease (encephalopathy).

Theta rhythm, 4 - 7 Hz. The theta rhythm occurs during drowsiness


and in certain stages of sleep.
Alpha rhythm, 8-13 Hz. This rhythm is most prominent
in normal subjects who are relaxed and awake with eyes
closed; the activity is suppressed when the eyes are
open. The amplitude of the alpha rhythm is largest in the
occipital regions.

Beta rhythm, 14-30 Hz. This is a fast rhythm with low


amplitude, associated with an activated cortex and which can be
observed, e.g., during certain sleep stages. The beta rhythm is
mainly observed in the frontal and central regions of the scalp.

Gamma rhythm, >30 Hz. The gamma rhythm is related to a


state of active information processing of the cortex. Using an
electrode located over the sensorimotor area and connected to a
high-sensitivity recording technique, the gamma rhythm can be
observed during finger Movements.
RECORDING TECHNIQUE
INTERNATIONAL 10-20 SYSTEM
EEG SIGNAL FROM PATIENT
1.Baseline of EEG signal
pop_rmbase( )
function [EEG, com] = pop_rmbase( EEG, timerange, pointrange);
com ='';
if isempty(EEG(1).data)
disp('pop_rmbase(): cannot remove baseline of an empty dataset'); return;
end;
if nargin < 1
help pop_rmbase;
return;
end;
if nargin < 2 & EEG(1).trials > 1
timerange = [num2str(EEG(1).xmin*1000)
num2str(EEG(1).xmax*1000)]; % whole epoch latency
range
fprintf('pop_rmbase(): using whole epoch as
baseline.\n');
elseif nargin < 2 & EEG(1).trials == 1
if isempty(result), return; end;
if ~isempty(usrdat) ,return; end;
% -----------------
if numel(result) < 2 | ((isempty(result{1}) | strcmp(result{1},'[]') ) ...
& (isempty(result{2}) | strcmp(result{2},'[]')))
timerange = [num2str(EEG(1).xmin*1000)
num2str(EEG(1).xmax*1000)]; % whole epoch latency range
fprintf('pop_rmbase(): using whole epoch as baseline.\n');

else
timerange = eval( [ '[' result{1} ']' ] );
pointrange = eval( [ '[' result{2} ']' ] );
end

resp = 'pop_rmbase', ('Remove mean of each data channel');


Return,
End;
EEG.data = rmbase( reshape(EEG.data, EEG.pnts*EEG.trials, pointrange
);
end;

if ~isempty(timerange)
com = sprintf('%s = pop_rmbase( %s, [%s]);', inputname(1),
inputname(1), ...
num2str(timerange));
else
com = sprintf('%s = pop_rmbase( %s, [], %s);', inputname(1),
inputname(1), ...
vararg2str({pointrange}));
end;
return;
RE-REFERENCING EEG SIGNAL
Re-referencing only applies to EEG data, MEG is
reference-free. In EEG, voltages recorded at each
electrode are relative to voltages recorded at other
electrodes. Theoretically, a reference could be
anywhere but the reference needs to be carefully
chosen because any activity in the reference electrode
will reflected in the activity at other electrodes. Often,
the mastoids are chosen as reference electrodes,
because while being close in distance to the
electrodes, they record less signal from the brain
RE-REFERENCE CODE
data_out = ( data_in - ones( n_channels, 1 ) * ref_est' ) ;
if exist( 'nm' )
figure(1);clf;
subplot(3,2,1),plot( taxis, ref_est, '-k' ); title( 'reference
signal estimate' );
subplot(3,2,2),plot( taxis, err, '-k+' ); , title( [{'robust
estimation error (squared & normalized)'},{''}] );
xlabel( 'time' ), ylabel( 'error' )
subplot(3,2,4),imagesc( data_out ); c = caxis;
colorbar, title( 'rCARIII data' )
subplot(3,2,3),imagesc( taxis, 1:n_channels, data_in ); colorbar,
title( 'data' ); caxis( c );
subplot(3,2,5), plot( taxis, nn_ref_est, 'k+' ), colorbar, title(
'Number of Used Channels' ), set(gca,'ylim',[-1 20] )
subplot(3,2,6), plot( taxis, used_iter, 'k+' ), colorbar, title(
'Used Iteration' ), %set(gca,'xlim',[1 120] )
%print -depsc2 ../out/rCARII.eps, close(1);
print( nm, '-dpsc2', '-append' ), close(1);
end
if( 0 )
keyboard
figure(2);clf;
subplot(1,2,1), plot( taxis, median(
data_in ), '-k' );title('median datain')
subplot(1,2,2), imagesc( data_in - ( ones(
19, 1 ) * median( data_in ) ) ), title(
'median re-ref data' )
print( nm, '-dpsc2', '-append' ),
close(2);
end % if( 0 )

data_out = data_out';
end
Graphic:
RE-SAMPLING

It is to decrease the size of your datafile and


facilitate quicker processing of your data, you
should resample your data according to the
Nyquist rule, the sampling frequency must be
at least twice the highest frequency that we
wish to analyse. If we are carrying out signal
with 30Hz. That means, a resampling frequency
would be 60Hz.
RESAMPLING CODE
pop_resample() - resample data (pop up
window).
Usage: >> [OUTEEG] = pop_resample(
INEEG ); % pop up interactive window
>> [OUTEEG] = pop_resample( INEEG, freq);

>>. Inputs: INEEG

input data freq - frequency to resample (Hz


Outputs: OUTEEG - output data
FILTERING

A band-pass filter (also spelled band pass) is a device that passes


frequencies within a certain range and rejects (attenuates) frequencies
outside that range .

POP_EEGFILTNEW:
If nargin < 1

help pop_eegfiltnew

return

end

if isempty (EEG. data)

error (cannot filter empty dataset.);

End
if nargin < 2
geometry = {[ 3, 1}, [3, 1], [3, 1], 1, 1, 1, 1};
geomvert = [ 1 1 1 2 1 1 1];
result = inputgui ( geometry , geometry, geomvert , geomvert , title , filter
the data pop_eegfiltnew, helpcom , pophelp )
if isempty (result) , return; end
locutoff = str2num (result {1}) ;
hicutoff = str2num (result {2});
filttorder = str2num (result {3});
revfilt = result {4};
minphase = result {5};
plotfreq = result {6};
usefft = [];
Else
if nargin < 3
hicutoff = [];
if nargin < 4
filtorder = [];
end
if nargin < 5 || isempty(revfilt)
revfilt = 0 ;
end
if nargin < 6
usefft == 1
end
if nargin < 7 ||isempty (plotfreqz)
plotfreqz = 0
end
if nargin < 8 ||isempty (minphase)
minphase = 0;
end
if locutoff == 0,loucytoff = []; end
if if locutoff == 0,loucytoff = []; end
if hicutoff == 0, hicutoff = [] ; end
if isempty(hicutoff)
hicutoff = locutoff ;
locutoff = [];
revfilt = ~revfilt ;
end
edgArray = sort([locutoff hicutoff )];
if isempty (eddgArray)
error (Not enough input regrument .);
end
if any (edgArray < 0 |edgeArray >= fNquist )
error (cutoff freqency out of range);
end
if ~isempty (filtorder) && (filtorder < 2|| mod (filtorder, 2) ~=0)
end
maxTBWArray = edgArray ;
if revfilt == 0
maxTBWArray (end) = fNYquist edgeArray (end);
else if length (edgeArray) l 2 ;
end
maXDF = min (maxTBWArray);
if isempty (filtorder)
if ervfilt == 1
df = min ([maxDF * TRANSWIDTHRATIO 2]) maxDF ];
else
df = min ([max([edgeArray(1)* TRANSWIDTHRATIO 2 ])MAXdf]);
END
POWER INTERFERENCE
The standard frequency in North American is 60 HZ , while
50 HZ in rest of the world.
So here in Sudan it is 50Hz.
The power line interface (50/60 Hz) is the main source of
noise in most of the bio-electric signal.
We will use a Notch filter.
A notch filter is a band-stop filter with a narrow stopband
(high Q factor).
The quality factor of a notch filter is, Q= (f2 - f1)/fcenter.
The center frequency is the center frequency of the
stopband for a notch filter. It is the also referred to as the
null frequency or the notch frequency.
FILTERING 50HZ USING A NOTCH FILTER IN
MATLAB :
fs = 2000; %#sampling rate
f0 = 50; %#notch frequency
fn = fs/2; %#Nyquist frequency
freqRatio = f0/fn; %#ratio of notch freq. to Nyquist freq.

notchWidth = 0.1; %#width of the notch

#%Compute zeros
notchZeros = [exp( sqrt(-1)*pi*freqRatio ), exp( -sqrt(-
1)*pi*freqRatio )];
%#Compute poles
notchPoles = (1-notchWidth) * notchZeros;
figure;
zplane(notchZeros.', notchPoles.');

b = poly( notchZeros );
a = poly( notchPoles );

figure;
freqz(b,a,32000,fs)

%#filter signal x
y = filter(b,a,x);
DETECTION
several methods can be used to detect bad electrodes :
1- Visual detection :
To get a general idea of the quality of your data it is
always good to look at it.
To visualise your data :
>> Plot >> Channel data (scroll)
If you are visualising your data before filtering, you may
want to remove the 0Hz offset. In the eegplot window
>> Display >> Remove DC offset
To visualise the data as a butterfly, select the Stack
option. This is a good way of checking for bad electrodes
and for periods of noisy data.
- 2-Statistical measures :

Statistical measures of the behavior of signals for each


electrode and analysis of their spectral properties .
EEGLAB provides a function for the automatic detection of bad
electrodes in data using :
- Kurtosis :
A signal with normal distribution has a kurtosis value near to 0.
The kurtosis value is expressed as z-score.
The default z-score limit is 5
- Probability :
This quantifies the time course of the electrode signals .
noisy electrodes unusual time courses.
- Spectral measures :
Reveal electrodes contaminated by noise that has a
characteristic frequency range.
The function PSD_calc(), calculates
the Power Spectral Density (PSD) for each
electrode.
The user can identify potential bad
electrodes from PSD plot; bad electrodes are
characterised by :
- Greater activity in the low frequency range
or
- A lower amplitude at all frequencies than
the other electrodes .
MATLAB CODE
function [k] = kurt(data)
[r,c]=size(data);
if r==1,
kdata = data'; % if a row vector, make into a column vector
r = c;
else
kdata = data;
end
% fprintf ('size of k data = [% d, % d] \ n', size(kdata,1),size(kdata,2));
mn = mean( k data); % find the column means
diff = kdata -ones(r,1)* mn; % remove the column means
dsq = diff.*diff; % square the data

k = (sum(dsq.*dsq)./std(kdata).^4)./r - 3;
pop_rejchan function :

pop_rejchan() - reject artifacts channels in an EEG dataset using joint


probability of the recorded electrode.

Usage:
>> pop_rejchan( INEEG ) % pop-up interative window mode
>> [EEG, indelec, measure, com] = pop_rejchan( INEEG, 'key', 'val');

Inputs:
'elec' - [n1 n2 ...] electrode number(s) to take into consideration for rejection
'threshold' - [max] absolute thresold or activity probability limit(s) (in std. dev.) if norm is
'on'.
'measure' - ['prob'|'kurt'|'spec'] compute probability 'prob', kurtosis 'kurt or spectrum 'spec'
for
each channel. Default is 'kurt'.
'norm' - ['on'|'off'] normalize measure above (using trimmed normalization as described
in the function jointprob() and rejkurt(). Default is 'off'.
'precomp' - [float array] use this array instead of computing the 'prob' or 'kurt' measures.
'freqrange' - [min max] frequency range for spectrum computation. Default is 1 to sampling
rate. divided by 2.

The average of the log spectral power is computed over the frequency range of interest.
CONCLUSION

We applied different mat lab functions on


(EEG) signal in order to DE noise the signal
to be used in right diagnosis.

Das könnte Ihnen auch gefallen