Skip to content

refactor(ecg): make feature extraction per-lead

Dharamveer requested to merge dharmveer-dev into master

Replace shared single-lead state with per-lead vectors so each lead tracks its own R-peaks, heart rate, sample counters, and buffer offsets independently.

  • ComputeHeartRate/IsNewRpeakDetected now take a LeadIndex and store results per lead (m_Bpm, m_LastQrsIndex, m_rPeakIndexes[lead]).
  • GetSamplCounter/SetSampleCounter replaced by per-lead GetSampleCounter/SetSampleCounter with bounds checking.
  • Rename m_FlatSampleCount -> m_ZeroDataCounter and m_BufferInitialSample -> m_BufferStartIndex[lead]; drop the unused m_GlobalSampleCounter-only buffer field.
  • Move R-peak history init, annotation reset, and per-lead state clearing into ClearAllVector; remove duplicate resets in ResetExtractionProcess.
  • Add missing ptu signal offset validation in ProcessSingleLead.
  • Update tests and dataset fixtures to the per-lead APIs; add fixtures and tests for 00010_hr, 00470_hr, and ecg1 records.

Merge request reports

Loading