-
Notifications
You must be signed in to change notification settings - Fork 8
/
main.cpp
37 lines (31 loc) · 968 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <QVector>
#include <QList>
#include <QtAlgorithms>
#include <QFile>
#include <QTextStream>
#include "butter.h"
#include "wavelet.h"
#include "sgolay.h"
template<typename T>
void save(const T& container, const QString& filename)
{
QFile file(filename);
file.open(QIODevice::WriteOnly | QIODevice::Text);
QTextStream in(&file);
for(int i = 0; i < container.size(); ++i)
in << qSetRealNumberPrecision(20) << container[i] << "\n";
}
extern int ecg_data_int[];
extern int ecg_data_size;
int main(int argc, char *argv[])
{
QVector<double> ecgData(ecg_data_size);
qCopy(ecg_data_int, ecg_data_int + ecg_data_size, ecgData.begin());
QVector<double> wv = processWavelet(ecgData, 7);
QVector<double> bt = processButter(ecgData);
QVector<double> sg = processSGolay(ecgData, 3, 500);
save(ecgData, "signal_base.txt");
save(wv, "wavelet.txt");
save(bt, "butterworth.txt");
save(sg, "savitzkygolay.txt");
}