-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
46 lines (34 loc) · 1.11 KB
/
main.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
30
31
32
33
34
35
36
37
38
39
40
import numpy as np
import wezel
#import dbdicom as db
#from mdreg import MDReg
import menu as tristan
wsl = wezel.app(wezel.apps.dicom.Windows)
wsl.set_menu(tristan.dev)
wsl.show()
exit()
attr = [
'SliceLocation', 'AcquisitionTime',
'FlipAngle', 'EchoTime', 'InversionTime',
]
# Get data
path = 'C:\\Users\\steve\\Dropbox\\Data\\TRISTAN_patient_examples_2\\v4_1\\data-rzp2'
folder = db.Folder(path, attributes=attr)
series = folder.series(SeriesDescription='dev')[0]
#array, dataset = series.array(['SliceLocation','AcquisitionTime'], pixels_first=True)
array, dataset = series.array('AcquisitionTime', pixels_first=True)
# Perform mdreg
mdr = MDReg()
mdr.export_path = 'C:\\Users\\steve\\Dropbox\\Data\\TRISTAN_patient_examples_2\\'
mdr.set_array(np.squeeze(array[...,0]))
mdr.fit()
mdr.export()
# Save results as dicom
array[...,0] = mdr.coreg
fit = series.new_cousin(SeriesDescription = series.SeriesDescription + '_coreg')
fit.set_array(array, dataset, pixels_first=True)
# Display results in wezel
wsl = wezel.app(Windows)
wsl.set_menu(tristan.dev)
wsl.set_data(folder)
wsl.show()