%% [ footIndex, systolicIndex, notchIndex, dicroticIndex, time, bpwaveform ] = BP_annotate( inWaveform, inFs, verbose, Units, isClean )
% Implementation of a feature detection algorithm for arterial blood
% pressure in humans. The foot of the wave, systolic peak, dicrotic notch,
% and dicrotic peaks are identified. The blood pressure time series is
% always resampled at 200 Hz to allow standardisation.
% The technique was largely inspired by the derivatives and thresholds
% described in Pan-Tompkins:
% Pan, Jiapu, and Willis J. Tompkins. "A real-time QRS detection algorithm."
% IEEE transactions on biomedical engineering 3 (1985): 230-236.
% We also use criteria described by Sun, J. X., A. T. Reisner, and R. G. Mark. in
% "A signal abnormality index for arterial blood pressure waveforms."
% Computers in Cardiology, 2006. IEEE, 2006.
% These criteria have not been extensively tested by us.
% inWaveform : countinuous arterial blood pressure time-series
% inFs : sampling frequency (Hz) of the time-series
% verbose : boolean, should be true if figures are wanted
%% Otional Inputs
% Units : string, 'mmHg' or other, only mmHg are dealt with so far
% isClean : boolean, should be true if confidence in the entire signal is
% high. It allows annotation before the threshold window has initiated.
% footIndex : index of the foot of each systolic wave
% systolicIndex : index of each sytolic peak
% notchIndex : index of each dicrotic notch
% dicroticIndex : index of each dicrotic peak
% time : time vector (s) of the resampled 200 Hz time-series
% bpwaveform : resampled filtered 200 Hz time-series
%% Foot index
% The foot index is defined as the point where the second derivative of
% the time-series is the highest in each interval where a moving average
% of the second derivative was bigger than a adaptative threshold. This
% criterion was preferred over others because of its robustness. It is
% possible to move this index to the minimum of the signal in this region
% by uncommenting line 330 in the source code.
%% Systolic peak index
% The systolic peak is defined as the maximum of the waveform following
% the foot index, relative to a window of radius 1/8 s around itself.
%% Dicrotic notch and peak indices
% The dicrotic notch is defined as the minimum of the subtraction of the signal and the staight
% line going from systole to diastole. Dicrotic peak indices were defined as the minimum of the
% second derivative of the time-series following the dicrotic notch, relative to a window of
% radius RR/5 s around itself. (RR is the median heartbeat interval computed form the
% foot indices). These indices are moved to waveform minima and maxima if
% these exist.
% Alexandre Laurin, PhD, ?cole Polytechnique, France, firstname.lastname@example.org
% Jona Joachim, MD, H?pital Lariboisi?re, France, email@example.com
minor bug fix for foot annotation when local minimum is needed
The notch criteria was updated after meetings with Pr Denis Chemla, cardiologist at APHP-CHU de Bicêtre.
Modified the criteria for systolic peak detection to fix certain problem cases.
Fixed a little bug in FIxIndex sub-function which prevented it from doing anything when a single index was out of bounds.
Includes example signals. To run: