LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

filter peaks on signal from ECG pulses!, help!

Solved!
Go to solution

Hello,

I have RRs from ECG signal. I filtered the ECG signal and get the RRs (interval between each ECG pulse).

filterECG.png

 

The source signal have noise I use one threshold but sometimes get fail peaks. Like the previous capture. Normally if you get a fail peak detected I will try to find this index and add to the left or right value of peak, normally I add to the lower value. That works If It only have one bad pulse between 2 good ones.

The problem come when I have more than  one peak detected between the two good ones. 

Also, when the threshold loss one R pulse I try to find the index and get 2 new reading doing the peak value division for 2. 

I attached the method I used to fit it. I only works if I have 1 peak added on real R measures or 1 loss R pulse, when I have several peaks no work.

 

I would like to hear any idea to get it work better. Since I dont like the idea to remove the value interval, I have 2 hours of readings and If I remove the values I will have lower data outoput, thats why I tried to sum or division the values to get the correct reading without loss data.

 

Maybe there is any better filter for ECG input, so I would have a clean R pulse and less noise between pulses ECG. 

Any advise is welcome.

 

Regards, Fred.

 

 

 

 

 

0 Kudos
Message 1 of 8
(5,465 Views)

1. A high pass filter will usually make noise issues worse, not better.

2. The VI you posted has no ECG signal, just RRs.

3. The way you use the event structure makes no sense. Place the boolean terminals inside the Value Changed event case for that control.

 

I presume that you are trying to do something else with this program because nothing changes between iterations of the loop. Both the loop and the event structure are completely meaningless in the VI you posted.

 

You might look into the Savitsky-Golay filter for smoothing the noise from the ECG signal before extracting the RR intervals.

 

I would put most of my efforts into getting accurate RR intervals from the ECG rather than trying to guess what to do with the RRs after the ECG signal is no longer available.  Regardless, due to ectopic beats or motion artifacts, it is likely that at least a few RR intervals will be impossible to recover from a 2 hour recording. You shuold decide how you will handle those incidents so that they have minimal impact on your analysis of the data.  Identify those beats at the RR detection point. Either mark them by a special value (-1 or NaN or something else) so that they can be handled approriately by the analysis code.

 

Lynn

0 Kudos
Message 2 of 8
(5,449 Views)

1. A high pass filter will usually make noise issues worse, not better.

 

Yes, I know its no the better. But It worked for get the RRs better than other filter than use Wavelet Transform Approach. 

 

2. The VI you posted has no ECG signal, just RRs.

 

 I dont put the ECG for the size of file. It is like the picture.

 

3. The way you use the event structure makes no sense. Place the boolean terminals inside the Value Changed event case for that control.

 

I presume that you are trying to do something else with this program because nothing changes between iterations of the loop. Both the loop and the event structure are completely meaningless in the VI you posted.

 

 Yes, for sure. The event structure is no sense in this case it is one part of whole program. Sorry for maintain the Event Structure.

 

 

You might look into the Savitsky-Golay filter for smoothing the noise from the ECG signal before extracting the RR intervals.

 

I would put most of my efforts into getting accurate RR intervals from the ECG rather than trying to guess what to do with the RRs after the ECG signal is no longer available.  Regardless, due to ectopic beats or motion artifacts, it is likely that at least a few RR intervals will be impossible to recover from a 2 hour recording. You shuold decide how you will handle those incidents so that they have minimal impact on your analysis of the data.  Identify those beats at the RR detection point. Either mark them by a special value (-1 or NaN or something else) so that they can be handled approriately by the analysis code.

 

 I dont know if Savitzky Golay filter would be better. I try to loss the minimal pulses. Sometimes like you say, they could be ectopic beats, in this case is for 24h ECG signal, checking HR for 24h and getting some info about the RRs. Its no so important test for ectopic beats.

I would like to raise the pulse R for easier peak detection of each beat.

 

Regards.

0 Kudos
Message 3 of 8
(5,423 Views)

The way I have done this in the past to enhance the R peaks is the following

 

1. Take the derivative of the ECG signal (call this signal X)

2. Perform the Hilbert Transform on signal X (call this signal Y)

3. Create a complex waveform X + jY

4. Take the magnitude of this complex waveform and you should see a nice peak where the R peak is located

 

 

 

Randall Pursley
Message 4 of 8
(5,416 Views)

rpursley8 escribió:

The way I have done this in the past to enhance the R peaks is the following

 

1. Take the derivative of the ECG signal (call this signal X)

2. Perform the Hilbert Transform on signal X (call this signal Y)

3. Create a complex waveform X + jY

4. Take the magnitude of this complex waveform and you should see a nice peak where the R peak is located

 

 

 


Hi Randall,

Thanks for reply!.

 

Do you mean so?.

 

ecgfilter2.png

 

Removing the Highpass filter, of course.

Regards.

 

0 Kudos
Message 5 of 8
(5,398 Views)
Solution
Accepted by topic author Fonsi

Almost.  in the last step you extracted the real part of the complex waveform.  Instead, you need to extract the magnitude.

 

Complex.png

 

BTW, this idea isn't mine.  I got it from this paper

 

http://www.sciencedirect.com/science/article/pii/S0010482501000099

 

 

Algorithm.png

Randall Pursley
Message 6 of 8
(5,321 Views)

Hi Randall,

 

Thanks it works well for me. 

Regards.

0 Kudos
Message 7 of 8
(5,312 Views)

Hi, Fonsi,

 

            Could you post your peak remove.vi here?

0 Kudos
Message 8 of 8
(4,442 Views)