Software Open Access
R-DECO: An open-source Matlab based graphical user interface for the detection and correction of R-peaks
Jonathan Moeyersons , Matthew Amoni , Sabine Van Huffel , Rik Willems , Carolina Varon
Published: Sept. 8, 2020. Version: 1.0.0
When using this resource, please cite:
(show more options)
Moeyersons, J., Amoni, M., Van Huffel, S., Willems, R., & Varon, C. (2020). R-DECO: An open-source Matlab based graphical user interface for the detection and correction of R-peaks (version 1.0.0). PhysioNet. https://doi.org/10.13026/x6j7-sp58.
Moeyersons J, Amoni M, Van Huffel S, Willems R, Varon C. 2019. R-DECO: an open-source Matlab based graphical user interface for the detection and correction of R-peaks. PeerJ Computer Science 5:e226
Please include the standard citation for PhysioNet:
(show more options)
Goldberger, A., Amaral, L., Glass, L., Hausdorff, J., Ivanov, P. C., Mark, R., ... & Stanley, H. E. (2000). PhysioBank, PhysioToolkit, and PhysioNet: Components of a new research resource for complex physiologic signals. Circulation [Online]. 101 (23), pp. e215–e220.
Many of the existing ECG toolboxes focus on the derivation of heart rate variability features from RR-intervals. By doing so, they assume correct detection of the QRS-complexes. However, it is highly likely that not all detections are correct. Therefore, it is recommended to visualize the actual R-peak positions in the ECG signal and allow manual adaptations.
As a solution, we present R-DECO, an easy-to-use graphical user interface for the detection and correction of R-peaks. Within R-DECO, the R-peaks are detected by an adaptation of the Pan-Tompkins algorithm. Instead of using all the pre-processing steps of the latter algorithm, the proposed algorithm uses only an envelope-based procedure to flatten the ECG and enhance the QRS-complexes. The algorithm obtained an overall sensitivity of 99.60% and positive predictive value of 99.69% on the MIT/BIH arrhythmia database. Additionally, R-DECO includes support for several input data formats for ECG signals, three basic filters, the possibility to load other R-peak locations and intuitive methods to correct ectopic, wrong, or missed heartbeats. All functionalities can be accessed via the graphical user interface and the analysis results can be exported as Matlab or Excel files.
Through its easy-to-use-graphical user interface, R-DECO allows both clinicians and researchers to use all functionalities, without previous knowledge. R-DECO has been developed on Windows 10 using Matlab 2018a. GUIDE, MATLAB’s GUI development environment, was used to design the GUI of R-DECO. It has been tested and proven to be functional for older Matlab versions going back to Matlab 2016a.
R-DECO is the first step toward a complete ECG processing tool. At the moment, it focuses on accurate R-peak detection and intuitive correction options. Therefore, it is a complementary tool for existing heart rate variability (HRV) analysis toolboxes, which tend to focus on the computation of HRV metrics from RR-intervals. Although some toolboxes already provide the possibility to detect R-peaks, their possibility to correct R-peak annotations is rather limited [1-3]. Additionally, to the best of our knowledge, none of the existing toolboxes provide filtering, R-peak detection and correction all together.
The main advantage of R-DECO, according to the authors, is the easy-to-use, intuitive GUI. All actions are performed in one window, which simplifies the use and reduces the learning time.
Several extra features are being developed and will be released in future versions. We intend to add support for other input file formats, such as hierarchical data format 5 files, general data format files, etc. However, most improvements will be in the number of analysis options. Some of the first extra analysis options will be automatic signal quality detection, ECG derived respiration (EDR) and HRV-analysis.
This section contains a description of R-DECO. The repository of the current software is hosted on GitLab .
The software package consists of three main folders: one folder with signal examples and two function folders. Unless you want to make changes to the codes, there is no need to access these folders. The main function is called 'R_DECO'. Execution of this function adds all the underlying folders and subfolders to the path and opens the GUI.
The software allows to load data from a folder or from the matlab workspace. As an example, you could load 'Single_lead_ECG_250Hz.mat'. This is a .mat example file which can be found in the examples folder. The software first tries to find a sampling frequency, but if this is not present, it will prompt a question dialog in which you can input the sampling frequency.
Before detecting the R-peaks, there are a couple of pre-processing steps that are available. Three basic filters are included in the program, a high, low and stopband filter. The order of the filters can be adjusted in the 'Preferences' tab. If you want to implement different filters, that is also possible in the 'filtersignal.m' code. Additionally, you can also select an analysis period. This might be useful if you have a long signal and only want to analyse a small section.
R-peaks can be detected by pushing the 'Detect Peaks' button. This will call an algorithm for the detection of R-peaks which is developed in our group. The QRS-complexes are highlighted by an enveloping procedure and peaks are detected in the resulting signal. A more elaborate description can be found in the paper .
Hereafter, the peaks can be investigated. It is possible to use the zoom button, to have a closer look, or to change the range of the x-axis manually. The slider can be used to slide through the signal.
The R-peak location can be corrected in a semi-automated or manual fashion. We included three semi-automated methods:
- The first method creates a template QRS-complex, by taking the trimmed mean of all the beats. The user can manually indicate the correct location of the R-peak and this is matched with all heartbeats using cross-correlation.
- The second method is called peak conversion. Sometimes it happens that when a peak is correctly annotated in the enveloped signal, it does not perfectly align with the peak in the raw signal. Peak conversion shifts the annotation towards the closest extremum.
- The third method allows the user to do a maximum, minimum or absolute maximum search in a pre-defined search window.
The peaks can also be adjusted manually. This can be done by right clicking on the desired peak or by selecting one of the radio buttons. The user can add, adjust or delete peaks and the RR or HR traces are adjusted automatically. A more detailed description can be found in the paper.
The resulting R-peak locations and respective RR-intervals can be exported as a .mat file or as an Excel workbook.
Installation and Requirements
- Install Matlab, if you have not already done so
- Download all files and folders
- Open Matlab and open the folder that contains the toolbox
- Open and run "R_DECO.m".
- R-DECO requires Matlab and, more specifically, the signal processing toolbox of Matlab.
- It is not possible to run R-DECO using GNU Octave.
- Open Matlab and open the folder that contains the toolbox.
- Open and run "R_DECO.m".
- Click the "From File" button in the "Data" panel in the top left corner.
- Open the "Examples" folder and subsequently open the "MATLAB" folder.
- Select and open "Single_lead_ECG_250Hz.mat".
- You will be prompted to enter the sampling frequency. Type 250 and press "OK".
- Based on visual inspection, baseline wander seems to be present. This can be investigated in the frequency domain by pressing the "Check PSD" button in the "Filter" panel.
- Type 0.66 next to "High pass" and press the "Filter" button. This will high-pass filter the signal with a second order Butterworth filter.
- The difference with the original signal can be visually compared by checking the "Show original" checkbox.
- Press the "Define analysis period" button in the "Analysis Period" panel.
- If you go over the signal plot, this will prompt a vertical line, which represents the starting line of the analysis period.
- Click and hold down the left mouse button at 00:03:00 and drag the cursor to 00:04:00.
- In case the window limits are not accurate, there are two options:
- Drag the start and stop line or the entire window to the desired location with your mouse.
- Type the desired start time and duration in the "Analysis Period" panel.
- In case the window limits are not accurate, there are two options:
- Press the "Apply changes" button to confirm the analysis window.
- Press the "Detect Peaks" button to detect the R-peaks.
- Use the default parameter values and press "OK" in the bottom right corner.
- From the tachogram, the bottom plot, an ectopic can be observed at time point 00.03.18. Right click the R-peak in the signal plot and select the desired option to deal with it.
- When finished with the adaptations, press the "Menu" button in the top left corner, go to "Export Results" and press "To Workspace".
- Perform the desired follow-up analysis with the exported ECG signal, R-peaks and RR-intervals.
The research leading to these results has received funding from the European Research Council under the European Union’s Seventh Framework Programme (FP7/2007-2013) / ERC Advanced Grant: BIOTENSORS (n339804). This paper reflects only the authors’ views and the Union is not liable for any use that may be made of the contained information. RW is a Senior Clinical Investigator of the Research Foundation - Flanders (FWO).
Grant details: Bijzonder Onderzoeksfonds KU Leuven (BOF): SPARKLE: IDO-10-0358, The effect of perinatal stress on the later outcome in preterm babies: C24/15/036, TARGID: C32-16-00364; Agentschap Innoveren & Ondernemen (VLAIO): Project: STW 150466 OSA + O&O HBC 2016 0184 eWatch; imec: SBO-2016, ICON: HBC.2016.0167 SeizeIT; European Research Council.
Conflicts of Interest
No conflicts of interest.
- Pichot V, Roche F, Celle S, Barthélémy J, Chouchou F. 2016. HRVanalysis: A Free Software for Analyzing Cardiac Autonomic Activity, Frontiers in Physiology, 7, 557, https://doi.org/10.3389/fphys.2016.00557
- Niskanen J-P, Tarvainen MP, Ranta-aho PO, Karjalainen PA. 2004. Software for advanced HRV analysis. Comp Meth Programs Biomed, 76(1), 73-81.
- Kaufmann T, Sütterlin S, Schulz S, Vögele C. 2011. ARTiiFACT: a tool for heart rate artifact processing and heart rate variability analysis. Behavior Research Methods, 43(4), 1161-1170. doi:10.3758/s13428-011-0107-7
- R-DECO Code Repository on GitLab: https://gitlab.esat.kuleuven.be/biomed-public/r-deco
- Moeyersons J, Amoni M, Van Huffel S, Willems R, Varon C. 2019. R-DECO: an open-source Matlab based graphical user interface for the detection and correction of R-peaks. PeerJ Computer Science, 5(226), https://doi.org/10.7717/peerj-cs.226.
Anyone can access the files, as long as they conform to the terms of the specified license.
License (for files):
GNU General Public License version 3
algorithms and analysis of algorithms signal processiong visual analysis graphical user interface
Total uncompressed size: 930.6 KB.
Access the files
- Download the ZIP file (660.4 KB)
Download the files using your terminal:
wget -r -N -c -np https://physionet.org/files/r-deco/1.0.0/
|Parameterdialog.fig (download)||39.0 KB||2020-07-22|
|Parameterdialog.m (download)||16.4 KB||2020-07-22|
|calc_pos_opt.m (download)||3.5 KB||2020-07-22|
|ectopic_detection.m (download)||3.9 KB||2020-07-22|
|ectopic_detection_correction.m (download)||3.3 KB||2020-07-22|
|env_secant.m (download)||1.9 KB||2020-07-22|
|peak_detection.m (download)||27.0 KB||2020-07-22|