kota

PURPOSE ^

kota - QRS detection using Hilbert Transform

SYNOPSIS ^

function [ R_loc ] = kota( sig, detrended, fs )

DESCRIPTION ^

kota - QRS detection using Hilbert Transform
 Detects the location of R-peaks using the algorithm described by Kota &
 al.

 Process:
   1. High-Pass filtering
   2. Half-Wave rectifier
   3. Moving average (150ms)
   4. Moving window integration
   5. Find the instantaneous phase using the Hilbert Transform
   6. Find the R-Peak between each phase slip


 Inputs:
    sig - The preprocessed signal
    detrended - The detrended signal

 Outputs:
    R_loc - Array with the R-Peak locations


 Reference:
 Kota, S., Swisher, C.B. & al (2017). "Identification of QRS complex in
 non-stationary electrocardiogram of sick infants."
 Computers in Biology and Medicine 87 (2017) 211–216

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [ R_loc ] = kota( sig, detrended, fs )
0002 %kota - QRS detection using Hilbert Transform
0003 % Detects the location of R-peaks using the algorithm described by Kota &
0004 % al.
0005 %
0006 % Process:
0007 %   1. High-Pass filtering
0008 %   2. Half-Wave rectifier
0009 %   3. Moving average (150ms)
0010 %   4. Moving window integration
0011 %   5. Find the instantaneous phase using the Hilbert Transform
0012 %   6. Find the R-Peak between each phase slip
0013 %
0014 %
0015 % Inputs:
0016 %    sig - The preprocessed signal
0017 %    detrended - The detrended signal
0018 %
0019 % Outputs:
0020 %    R_loc - Array with the R-Peak locations
0021 %
0022 %
0023 % Reference:
0024 % Kota, S., Swisher, C.B. & al (2017). "Identification of QRS complex in
0025 % non-stationary electrocardiogram of sick infants."
0026 % Computers in Biology and Medicine 87 (2017) 211–216
0027 
0028 
0029 % Difference between successive samples of the signal – equivalent to a highpass filter – was calculated and the samples with negative values were set to zero
0030 
0031 sig = diff(sig);
0032 sig(length(sig)+1)=0;
0033 idx = sig < 0;
0034 sig(idx) = 0;
0035 
0036 % A 150 ms running average was calculated for the rectified data.
0037 timeWind = floor(fs * 150 / 1000); %150 ms window
0038 sig = movmean(sig, timeWind);
0039 
0040 movingAverage = sig;
0041 
0042 % MOVING WINDOW INTEGRATION
0043 % MAKE IMPULSE RESPONSE
0044 h = ones (1 ,31)/31;
0045 Delay = 30; % Delay in samples
0046 % Apply filter
0047 x6 = conv (sig ,h);
0048 N = length(x6) - Delay;
0049 x6 = x6 (Delay+[1: N]);
0050 
0051 sig = x6;
0052 
0053 % Hilbert Transform
0054 transformH = hilbert(sig);
0055 
0056 % Find the angle:
0057 angleRads = angle(transformH + sig);
0058 
0059 minPeakSeparation = floor( fs / 4); % Minimum separation between beats is a quarter of a second
0060 
0061 [pks,locs] = findpeaks(-angleRads,'MinPeakDistance', minPeakSeparation, 'MinPeakHeight',0);
0062 
0063 % FIND R-PEAKS
0064 %left = find(slips>0);
0065 left = locs;
0066 parfor i=1:length(left)-1
0067  [R_value(i), R_loc(i)] = max( detrended(left(i):left(i+1)) );
0068  R_loc(i) = R_loc(i)-1+left(i); % add offset
0069 end
0070 
0071 end
0072 
0073 
0074

Generated on Thu 15-Mar-2018 13:51:08 by m2html © 2005