EEG Presentation
EEG Presentation
EEG Presentation
Presentation About :
Electroencephalography (EEG)
Prepared by:
Hamida Tharwat
Doaa Mohamed
Reham Alhadi
Mihad Modather
Saraa Ali
Afraa Eltyeb
Leena Gamal
Introduction :
The Electroencephalography(EEG) :
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).
else
timerange = eval( [ '[' result{1} ']' ] );
pointrange = eval( [ '[' result{2} ']' ] );
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
POP_EEGFILTNEW:
If nargin < 1
help pop_eegfiltnew
return
end
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.
#%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 :
k = (sum(dsq.*dsq)./std(kdata).^4)./r - 3;
pop_rejchan function :
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