This repository contains three main resources. Algorithm_tester contains databases, algorithms and a script to test them. Annotator has a MATLAB script that allows annotation of WFDB ECG signals. Signal_generator contains MATLAB scripts that can generate synthetic ECG signals.
This code has been created and tested with Visual Studio Code 1.73.0, MATLAB R2022a, and Python 3.9. The versions of other libraries used can be found in requirements.txt
.
- Florian Kristof floriankri
- Peter Charlton peterhcharlton
- Leon Nissen LeonNissen
- Maximilian Kapsecker NumericalMax
Kristof et al., 'Detecting beats in the photoplethysmogram: benchmarking open-source algorithms', [under review], https://doi.org/10.1101/2023.11.07.23298202
- Install Visual Studio Code
- Install Python 3.9
- Install MATLAB R2022a or higher
- NB: We installed the following toolboxes: 'Fuzzy Logic', 'Statistics and Machine Learning', 'Signal Processing'.
- Install MATLAB Engine API for Python available here in Visual Studio Code.
- NB: When installing matlabengine on a Mac we: (i) installed Matlab_R2022b and added it to the paths using
export PATH=<matlabroot>/bin/:$PATH
andexport DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:<matlabroot>/bin/maci64
; (ii) created a Miniconda environment running Python version 3.9 (which provided a python interpreter for an intel chip) using the commandconda create -n ecgbeats python=3.9
; (iii) activated this environment usingconda activate ecgbeats
; and (iv) installed matlabengine usingcd <matlabroot>/extern/engines/python
andpython3 setup.py install
.
- NB: When installing matlabengine on a Mac we: (i) installed Matlab_R2022b and added it to the paths using
- Install the VS Code Python extension
- Clone the ecg_detector_assessment repository.
- Run
pip install requirements.txt
in Visual Studio Code - Try executing
/Algorithm_tester/main.ipynb
and see if and where it runs into errors- NB: When using the UNSW beat detector we had to recompile the mex files using the following commands:
mex <path>/ecg_detector_assessment/Algorithm_tester/detectors/unsw/minmaxfilter.cpp
andmex <path>/ecg_detector_assessment/Algorithm_tester/detectors/unsw/medianfilter.cpp
- NB: When using the UNSW beat detector we had to recompile the mex files using the following commands:
- Install MATLAB R2022a or higher
- Install Waveform Database Software Package (WFDB) for MATLAB and Octave available here
- Change all permanent paths in the files to your local paths
- Change paths to signals that should be used in
/Annotator/MAIN.m
This part is automatically executed by Algorithm Tester. If you want to setup the unchanged version please visit the initial page called Model for Simulating ECG and PPG Signals with Arrhythmia Episodes.
After Installation as described above the notebook should run through in one go. All variables that might be necessary to change can be found in the Control Variables part of the Notebook. To evluate databases change the respective value in the Control Variables to True
for one run. After successful evaluation change the respective Control Variable back to False
as each evaluation takes quite some time.
After changing the path to the respective folder that you want to read the signals from you can run /Annotator/MAIN.m
and follow the instructions in the terminal. After you have annotated some signals you can review them using the review function by again following the instructions in the terminal.
As described above this code is used in the /Algorithm_tester/main.ipynb
Notebook and is an adapted version of Model for Simulating ECG and PPG Signals with Arrhythmia Episodes. Please refer to the original version for usage instructions.