wfdb-python
wfdb-python copied to clipboard
qrs detector improvements
This will be the single thread for discussing improvements for qrs detectors. I will probably only be working on the xqrs
class in the near future.
Current thoughts:
- The filter used to accentuate the qrs (we'll call this the moving wave integration filter) is currently an upright ricker with a fixed width:
wavelet_filter = signal.ricker(self.qrs_width, 4)
. There are many things we could improve upon, such as:- Inverting it if we figure out the r wave is inverted
- Designing a set of template beats for different ecg channels.
If you don't mind, i add several suggestions:
- XQRS works pretty well and has good specificity, PPV and FPR for MIT-BIH Arrhythmia Database, The QT Database and others. But sometimes for real signals there are errors for R-peak localization. This error equals +/- one sample around of peak sample.
- Adding some marks for erroneous/noisy beats (GQPOST functionality: changing N annotations into artifact ("|") annotations if they are likely to be erroneous)
- Adding R-peak voltages in returning value of xqrs_detect()
- Designing a set of template for different type of the beats. Like in CONSTRUE framework (Atrial fibrillation, Bigeminy, Trigeminy, Ventricular flutter/fibrillation, etc.). Link to framework below: [https://github.com/citiususc/construe]
- Adding ECGPUWAVE functionality (P,T wave peak/limit locator). I don't know if XQRS is able to do it
One possible solution is to call the raw C function through Cython. I used this approach in some of our project
A bit off-topic but, is there any publication that describes the xqrs algorithm?
Hey @artur-deluca
You can find a review of some algorithms from this link:
https://physionet.org/content/challenge-2014/1.0.0/
And more technical detail here:
http://ecg.mit.edu/george/publications/qrs-cinc-2003.pdf
However, checking out the source code documentation from these three links will also help:
https://github.com/MIT-LCP/wfdb-python/blob/733f3e4e14a644cf1e1b39a2ca86bcc4f0271f7a/wfdb/processing/qrs.py#L13-L67 https://wfdb.readthedocs.io/en/latest/processing.html https://www.physionet.org/physiotools/wag/gqrs-1.htm https://www.physionet.org/physiotools/wag/wqrs-1.htm
Hope this helps!
Thanks @Lucas-Mc!