-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathECGST.cpp
100 lines (71 loc) · 1.88 KB
/
ECGST.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#include "ECGST.h"
#include <cstdlib>
#include <cstdio>
ECGST::ECGST (void) { }
ECGST::~ECGST (void) { }
double ECGST::Interval::thresh = 0.05;
ECGST::Interval::Interval(int p, int t, int r, int iso, int j, int st, double sl, double of) :
ponsetpoint(p), tendpoint(t), rpoint(r), isopoint(iso), jpoint(j), stpoint(st), slope(sl), offset(of)
{ }
bool ECGST::Interval::higher(const double &thresh) const
{
return offset < -1*thresh;
}
bool ECGST::Interval::lower(const double &thresh) const
{
return offset > thresh;
}
bool ECGST::Interval::normal(const double &thresh) const
{
return !(lower(thresh) || higher(thresh));
}
std::pair< int, int > ECGST::Interval::span() const
{
int start = (ponsetpoint == 0) ? isopoint - 10 : ponsetpoint - 10,
end = (tendpoint == 0) ? stpoint + 10 : tendpoint + 10;
return std::make_pair(start, end);
}
std::pair< int, int > ECGST::Episode::span() const
{
return std::make_pair(start-40, end+10);
}
const ECGST::Episode& ECGST::getEpisodeAt(int i) const
{
return episodes.at(i);
}
const ECGST::Interval& ECGST::getIntervalAt(int i) const
{
return intervals.at(i);
}
int ECGST::Interval::length() const
{
return stpoint - jpoint;
}
void ECGST::addInterval(const ECGST::Interval& interval)
{
intervals.push_back(interval);
}
void ECGST::addEpisode(const ECGST::Episode& ep)
{
episodes.push_back(ep);
}
const std::vector< ECGST::Interval >& ECGST::getIntervals() const
{
return intervals;
}
const std::vector< ECGST::Episode >& ECGST::getEpisodes() const
{
return episodes;
}
ECGST::Episode::Episode(int s, int e):
start(s), end(e)
{
}
std::pair< int, int > ECGST::getIntervalBeginAndEnd(int i) const
{
return intervals.at(i).span();
}
std::pair< int, int > ECGST::getEpisodeBeginAndEnd(int i) const
{
return episodes.at(i).span();
}