Ejemplo n.º 1
0
        void reader_DataReady(object sender, Herz.Common.DataReadyEventArgs e)
        {
            if (!stop)
            {
                foreach (ECGSample s in e.ECGSignalChunk)
                {
                    if (!rawQueue.IsAddingCompleted)
                    {
                        rawQueue.Add(new ECGSample(s.Index, s.Value));
                    }
                }

                List <ECGSample> filteredChunk = PanTompkins.Execute(e.ECGSignalChunk).ToList();

                foreach (ECGSample s in filteredChunk)
                {
                    if (!filteredQueue.IsAddingCompleted)
                    {
                        filteredQueue.Add(new ECGSample(s.Index, s.Value));
                    }
                }

                foreach (ECGSample s in detector.Execute(filteredChunk))
                {
                    if (!detectedQRSQueue.IsAddingCompleted)
                    {
                        detectedQRSQueue.Add(new ECGSample(s.Index, s.Value));
                        estimator.RRPeaks.Add(new ECGSample(s.Index, s.Value));
                        RecalculateFeatures();
                    }
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Wrapper method for event invocation.
 /// </summary>
 /// <param name="e">ECG data chunk.</param>
 protected virtual void OnBufferFullEvent(DataReadyEventArgs e)
 {
     EventHandler<DataReadyEventArgs> handler = DataReady;
     // handler will be null if there are no subscribers to event
     if (handler != null)
         handler(this, e); // raise event
 }