Skip to content

qrs detector improvements #136

Open
Open

Description

@cx1111

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.

Activity

  1. changed the title [-](x)qrs detector improvements thread[/-] [+](x)qrs detector improvements[/+] on Jun 22, 2018
  2. changed the title [-](x)qrs detector improvements[/-] [+]qrs detector improvements[/+] on Jun 22, 2018
  3. krivenkoz commented on Jun 23, 2018

    @krivenkoz

    If you don't mind, i add several suggestions:

    1. 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.
    2. Adding some marks for erroneous/noisy beats (GQPOST functionality: changing N annotations into artifact ("|") annotations if they are likely to be erroneous)
    3. Adding R-peak voltages in returning value of xqrs_detect()
    4. 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]
    5. Adding ECGPUWAVE functionality (P,T wave peak/limit locator). I don't know if XQRS is able to do it
  4. peiyaoli commented on Nov 21, 2018

    @peiyaoli

    One possible solution is to call the raw C function through Cython. I used this approach in some of our project

  5. artur-deluca commented on Feb 9, 2021

    @artur-deluca

    A bit off-topic but, is there any publication that describes the xqrs algorithm?

  6. Lucas-Mc commented on Feb 9, 2021

    @Lucas-Mc
    Contributor

    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:

    class XQRS(object):
    """
    The QRS detector class for the XQRS algorithm. The `XQRS.Conf`
    class is the configuration class that stores initial parameters
    for the detection. The `XQRS.detect` method runs the detection algorithm.
    The process works as follows:
    - Load the signal and configuration parameters.
    - Bandpass filter the signal between 5 and 20 Hz, to get the
    filtered signal.
    - Apply moving wave integration (MWI) with a Ricker
    (Mexican hat) wavelet onto the filtered signal, and save the
    square of the integrated signal.
    - Conduct learning if specified, to initialize running
    parameters of noise and QRS amplitudes, the QRS detection
    threshold, and recent R-R intervals. If learning is unspecified
    or fails, use default parameters. See the docstring for the
    `_learn_init_params` method of this class for details.
    - Run the main detection. Iterate through the local maxima of
    the MWI signal. For each local maxima:
    - Check if it is a QRS complex. To be classified as a QRS,
    it must come after the refractory period, cross the QRS
    detection threshold, and not be classified as a T-wave
    if it comes close enough to the previous QRS. If
    successfully classified, update running detection
    threshold and heart rate parameters.
    - If not a QRS, classify it as a noise peak and update
    running parameters.
    - Before continuing to the next local maxima, if no QRS
    was detected within 1.66 times the recent R-R interval,
    perform backsearch QRS detection. This checks previous
    peaks using a lower QRS detection threshold.
    Attributes
    ----------
    sig : 1d ndarray
    The input ECG signal to apply the QRS detection on.
    fs : int, float
    The sampling frequency of the input signal.
    conf : XQRS.Conf object, optional
    The configuration object specifying signal configuration
    parameters. See the docstring of the XQRS.Conf class.
    Examples
    --------
    >>> import wfdb
    >>> from wfdb import processing
    >>> sig, fields = wfdb.rdsamp('sample-data/100', channels=[0])
    >>> xqrs = processing.XQRS(sig=sig[:,0], fs=fields['fs'])
    >>> xqrs.detect()
    >>> wfdb.plot_items(signal=sig, ann_samp=[xqrs.qrs_inds])

    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!

  7. artur-deluca commented on Feb 9, 2021

    @artur-deluca

    Thanks @Lucas-Mc!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions