-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdce.py
More file actions
48 lines (43 loc) · 1.54 KB
/
dce.py
File metadata and controls
48 lines (43 loc) · 1.54 KB
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
# Convert the dynamics DICOM files to fodler structures.
# The folder structure is required for using the Python
# registration framework.
#
# Use: run the following code in the Python console within 3D Slicer.
# Replace the path with the real path.
#
# exec(open(r'topFolder/code/dce.py', 'r').read())
#
import os
import sys
# Add the code folder to the path
topFolder = os.path.abspath(os.path.join(sys.executable, *([os.pardir]*4)))
sys.path.append(os.path.join(topFolder, 'code'))
from reg import sortDcm
def sortDce():
'''Convert the dynamics DICOM files to fodler structures.
The folder structure is required for using the Python registration framework.
No input argument, but will prompt you for selecting two folders,
one for source, one for destination.
Saves the sorted data to the destination folder.
'''
print("DCE-MRI data sorting")
dialog = ctk.ctkFileDialog()
print(" Please select the source folder")
sourceFolder = dialog.getExistingDirectory()
if sourceFolder:
print(" Source folder: ", sourceFolder)
else:
print(" No folder select. Task terminated.")
sys.exit()
print(" Please select the destination folder for the sorted DICOM")
destFolder = dialog.getExistingDirectory()
if destFolder:
print(" Destination folder: ", destFolder)
else:
print(" No folder select. Task terminated.")
sys.exit()
print(" Processing ... ")
sortDcm(sourceFolder, destFolder, 'dce')
print(" Completed.")
print()
sortDce()