Magnetic resonance imaging (MRI) gain more and more importance in clinical routine because of its high image quality and the absence of ionizing radiation. To detect cardiovascular diseases, cardiovascular MRI (CMR) is an increasing used, noninvasive diagnostic method . In clinical practice, MR scanners with field strength up to 3T are used , . The electrocardiogram (ECG) is used to synchronize the cardiac phase with the CMR image acquisition process. Another use of the ECG during MRI applications is the monitoring of the vital sign to ensure the safety of the patient. For both, gating and patient monitoring, the ECG’s R-wave or QRS-complex has to be detected accurately. However, QRS detection is hampered due to the magnetohydrodynamic (MHD) effect and the fast switching gradient magnetic fields inside the MRI scanner . Methods to reduce gradient and RF-induced artifacts were proposed in . Methods for filtering the MHD effect were presented in .
QRS detectors used in certified clinical monitoring systems need to be able to cope with different pathological test ECG signals according to the IEC 60601-2-27 standard . This standard can be tested using ANSI/AAMI EC13 test waveforms. In the past, different QRS detection algorithms for MRI were developed , , . However, most of these methods required multiple leads and were not tested according to the IEC standard.
This work proposes a new real-time QRS detector for MRI applications which fulfills the IEC standard. We have previously shown that the statistical central moments can be used for a reliable QRS detection in MRI . We propose to use an approach based on integrated variance to fulfill the IEC standard and to provide a reliable QRS detection during MRI. The technique was trained using the ANSI/AAMI EC13 test waveforms and tested with ECG signal recorded outside  and inside  the MRI.
2 Material and methods
For the development and evaluation of the novel QRS detector one training and two test databases were used. The training database DBTraining consists of the ANSI/AAMI E13 test waveforms (sampling rate: 720 Hz, resolution: 12 bit) . The aim with these test waveforms is to detect the average heart rate, i e. no QRS-complexes were annotated but only an average heart rate is given. In the datasets a ventricular bigeminy (VB, aami3a), slow alternating VB (aami3b) as well as a rapid alternating VB (aami3c) and bidirectional systoles (aami3d) are available. Further the heart rate during a ventricular tachycardia (aami4a: 1 mV peak-to-valley, aami4b: 2 mV peak-to-valley) has to be estimated correctly. Further the amplitude in aami4a and aami4b was halved (aami4a_h and aami4b_h) and doubled (aami4a_d and aami4b_d). For three datasets (aami3a, aami3b, aami3d), two acceptable HR were given as reference which means that some arrhythmic peaks are allowed to be missed by the QRS detector. Further a difference of 10% or 5 beats (what shows the higher difference) were allowed for a correct HR estimation.
The first test database (DBInCarT)  consisted of 12 lead ECG data in 75 records sampled with 257 Hz with over 175,000 annotated beats. The datasets were recorded from 15 female and 17 male patients ranged from 18 to 80 years (mean age: 58 years). 3 datasets (54, 57 and 58) were rejected because of a missing signal. A total of 168,341 annotated QRS complexes were used for the evaluation of the QRS detector.
The second test database (DBMRI) consisted of ECG signals acquired inside a 3T MRI (Siemens, Skyra, Germany) in head first and feet first position. The ECG data were recorded using a 12-lead Holter ECG (CardioMem CM3000-12, GETEMED, Germany) with a sampling frequency (fs) of 1024 Hz and a resolution of 12 bit. The overall length of the database was 2.25 h with 9421 annotated QRS complexes.
The ECG signals were bandpass filtered (5th order, 45 Hz Butterworth low-pass and 3rd order, 0.5 Hz Butterworth high-pass filter) to reduce noise and baseline wander. The variance of a vector X = [x1, x2, …, xL] was computed as
in a sliding window L = 0.02 s ⋅ fs with a step width of 1 sample where fs is the sampling frequency of the ECG. This window length was chosen to fit into the upslope or downslope of the QRS complex. A step width of 1 sample preserved the original sampling frequency. The result of the variance was integrated in a sliding window of S = 0.05 s ⋅ fs. The threshold for QRS detection was defined as the median of the last 10 maxima of the integrated variance of the QRS complexes multiplied with a factor of 0.31. This factor was empirically determined using the training database. The different steps are pictured in Figure 1.
Finally, a decision rule was applied to further improve the QRS detection. If the slope of the integrated variance and the QRS-complex was positive, the detected value was set on the R-peak. If the slopes had different signs, the detected position was chosen.
2.3 Evaluation metric
To evaluate the new QRS detector (M1) the sensitivity (Se) and the positive predictive value (+P) were calculated according to the ANSI/AAMI EC57 standard . These statistical parameter can be written as:
The true positive detected beats are presented by TP, the false negative detected beats are presented by FN and FP represents the false positive detected beats. The detection error rate (DER) was calculated and defined as:
As presented in ,  only the precordial lead V4 was used for data evaluation. The precordial leads exhibit high R-peak amplitude due to their myocardium close proximity . Further the highest R-peak was represented by V4. The reason is the location near to the apex of the heart.
The proposed method was compared to other state-of-the-art QRS detectors. These detectors were based on the 4th order central moments (M2) , the 5th order cumulants (M3)  the Pan/Tompkins-based algorithm (M4)  and on ICA (M5) . All methods used an adaptive threshold.
The results of DBTraining used for threshold selection are presented in Table 1. It shows that all limits for a correct HR estimation for arrhythmias as well as for tachycardia were satisfied. Further all arrhythmia peaks except in aami3a could be detected. In aami3a the small arrhythmia peaks were ignored by the algorithm.
Estimated heart rates (HR) for DBTraining computed from the detected R-peaks using the variance-based method (M1).
|Dataset||Accepted HR (Bpm)||HR M1 (Bpm)|
QRS detection results using methods M1–M5 applied to DBMRI.
|Method||Beats||TP||FP||FN||+P (%)||Se (%)||DER (%)||Delay (ms)||Jitter (ms)|
QRS detection results using methods M1–M5 applied to DBInCarT.
|Method||Beats||TP||FP||FN||+P (%)||Se (%)||DER (%)||Delay (ms)||Jitter (ms)|
As shown in Table 2, method M1 showed best results concerning to the DER (0.23%) for DBMRI, the mean delay (3.82 ms) as well as the jitter (2.35 ms). Further M1 reached the best +P with 99.84%. Methods M2 and M3 achieved the best Se (99.99%). Worse results were achieved for M4 with a DER of 1.26% together with the highest jitter of 7.88 ms. Method M5 showed the highest mean delay (10.32 ms).
In contrast to DBMRI, the detection quality of M1 was lower when applied to database DBInCarT. Results are given in Table 3. Here M1 shows a DER of 1.01% together with a the highest mean delay of 25.57%. The best DER (0.54%) shows M5 as well best Se (99.63%).
A novel QRS detector based on integrated variance was developed on ANSI/AAMI test waveforms and evaluated using 12-lead ECG different databases. Considering the QRS detection for the ECGs acquired in a 3T MRI scanner, high Se and +P values as well as a low mean delay (< 20 ms) and jitter (< 15 ms) were obtained. Due to the low mean delay, the proposed can be used for real time CMR covering the complete systolic cardiac phase . The low jitter prevents a blurring of the CMR images .
In this study, the superior quality of ECG lead V4 was used to ensure a reliable QRS detection. These ECGs were acquired using non MR-safe hardware which makes this approach currently not usable in clinical practice. However, standard devices were modified previously and were successfully used during MRI scanning . This means that the high quality of a 12-lead ECG and especially of lead V4 could be used during MRI exams in the future.
Despite the training using ECG signals acquired outside the MRI (ANSI/AAMI EC13 waveforms), the proposed variance based detection technique (M1) shows best results concerning DER as well as mean delay and jitter when applied to the ECGs acquired during MRI. This shows the high robustness of this technique to distinguish arrhythmias from the MHD effect.
In conclusion, the proposed method could be used for gating in CMR and for patient monitoring during MRI examinations. In future works, the proposed algorithm will be applied to ECG signals with arrhythmias which were recorded during MRI exams.
Research funding: Marcus Schmidt and Johannes W. Krug are funded by the Federal Ministry for Economic Affairs and Energy (BMWi, Germany) under grant number KF3172301JL3. Conflict of interest: Authors state no conflict of interest. Material and Methods: Informed consent: Informed consent has been obtained from all individuals included in this study. Ethical approval: The research related to human use complies with all the relevant national regulations, institutional policies and was performed in accordance with the tenets of the Helsinki Declaration, and has been approved by the authors’ institutional review board or equivalent committee.
Lima JAC, Desai MY. Cardiovascular magnetic resonance imaging: current and emerging applications. J Am Coll Cardiol. 2004;44:1164–71.
Schmitt F, Grosu D, Mohr C, Purdy D, Salem K, Scott KT, et al. 3 Tesla-MRT: Der Erfolg höherer Feldstärken. Radiologie. 2004;44:31–48.
Nijm GM , Swiryn S, Larson AC, Sahakian AV. Extraction of the magnetohydrodynamic blood flow potential from the surface electrocardiogram in magnetic resonance imaging. Med Biol Eng Comput. 2008;46:729–33.
Oster J, Pietquin O, Kraemer M, Felblinger J. Bayesian framework for artifact reduction on ECG in MRI. International Conference on Acoustics, Speech, and Signal Processing : Proceedings (ICASSP) 2010;489–92.
Krug JW. Improved cardiac gating and patient monitoring in high field magnetic resonance imaging by means of electrocardiogram signal processing [Phd thesis]. Germany: Otto-von-Guericke-University; 2015.
IEC 60601-2-27: Medical electrical equipment – Part 2–27: Particular requirements for the basic safety and essential performance of electrocardiographic monitoring equipment. International Electrotechnical Commission 3;2011.
Fischer SE, Wickline SA, Lorenz CH. Novel real-time R-wave detection algorithm based on the vectorcardiogram for accurate gated magnetic resonance acquisitions. Magn Reson Med. 1999;42:361–70.
Krug JW, Rose G, Clifford GD, Oster J. ECG-based gating in ultra-high field cardiovascular magnetic resonance using an independent component analysis approach. J. Cardiovasc. Magn. Reson. 2013;15:104.
Schmidt M, Krug JW, Rose G. A real-time QRS detector based on higher-order statistics for ECG gated cardiac MRI. Comput Cardiol. 2014;41:733–6.
Schmidt M, Krug JW, Rose G. QRS detection using 5th order cumulants for ECG gated cardiac MRI. In Proc BMT, Hannover, Germany, 2014;59:180.
Goldberger AL, Amaral LAN, Glass L, Hausdorff JM, Ivanov PCh, Mark RG, et al. PhysioBank, PhysioToolkit, PhysioNet: components of a new research resource for complex physiologic signals. Circulation. 2000;101:e215–20.
Testing and Reporting Performance Results of Cardiac Rhythm and ST-Segment Measurement Algorithm. ANSI/AAMI:EC57 1998/(R)2003.
von Olshausen KE. EKG-Information. Germany: Steinkopff Verlag Darmstadt; 2005;8:19.
Clifford GD. Signal processing methods for heart rate variability [Phd thesis]. England: University of Oxford; 2002.
Lentner C. Geigy scientific tables: vol5. Heart and circulation. 8th ed. Ciba-Geigy; 1990.
Tse Z, Dumoulin C, Clifford G, Jerosch-Herald M, Kacher D, Kwong R, et al. MRI-compatible 12-lead ECGs with MHD separation: application to cardiac MRI gating, physiological monitoring and noninvasive cardiac-output estimation. Proc Intl Soc Mag Reson Med. 2010;18:286.