-
Notifications
You must be signed in to change notification settings - Fork 2
/
demo.py
29 lines (25 loc) · 919 Bytes
/
demo.py
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
from ecgImage import ECG_image_values
from ecgSignal import ECG_signal2QRS
import glob
# MAIN FUNCTION
if __name__ == "__main__":
#in_path ='/home/ecgProject/input/'
# in_path = './ECG-Elda/'
in_path = 'ecgc-set1/'
print('Processing ecgtovector')
types = (in_path + '*.jpg', in_path + '*.pdf') # the tuple of file types
files_grabbed = []
for files in types:
files_grabbed.extend(glob.glob(files))
for file in files_grabbed:
try:
print('Procesing File: ' + file)
ecg, Ts = ECG_image_values(file, draw=False)
print('Ts estimado: ' + str(Ts))
value = ECG_signal2QRS(ecg, Ts, draw=False)
print('QTC estimado: ' + str(value))
file = open(file + '_QTC.txt', "w")
file.write(str(value))
file.close()
except:
print('Procesing File: ' + file + ' ha Petado')