#ifndef _FEATURE_EXTRACTOR_H #define _FEATURE_EXTRACTOR_H #include "headfile.h" // ECG特征结构体 struct ECGFeatures { float heart_rate = 0.0f; // 心率 (bpm) float qrs_duration = 0.0f; // QRS波群时长 (ms) float qt_interval = 0.0f; // QT间期 (ms) float qtc_interval = 0.0f; // 校正的QT间期 (ms) std::vector st_segment; // ST段偏移值 (mV) float p_wave_amplitude = 0.0f; // P波振幅 (mV) float t_wave_amplitude = 0.0f; // T波振幅 (mV) }; // PPG特征结构体 struct PPGFeatures { float heart_rate = 0.0f; // 心率 (bpm) float perfusion_index = 0.0f; // 灌注指数 (PI) float pulse_width = 0.0f; // 脉搏波宽度 (ms) float amplitude_ratio = 0.0f; // 红光/红外光振幅比 float spo2 = 0.0f; // 血氧饱和度 (%) }; // 特征提取器类 class FeatureExtractor { public: // ECG特征提取 static ECGFeatures extract_ecg_features(const std::vector& ecg_signal, double sample_rate, int lead_index = -1); // PPG特征提取 static PPGFeatures extract_ppg_features(const std::vector& red_signal, const std::vector& ir_signal, double sample_rate); // 心率变异性(HRV)分析 static std::vector analyze_hrv(const std::vector& rr_intervals, double sample_rate); private: // QRS波群检测 static std::vector detect_qrs(const std::vector& ecg_signal, double sample_rate); // PPG峰值检测 static std::vector detect_ppg_peaks(const std::vector& ppg_signal, double sample_rate); }; #endif