-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbratsPreprocessor.py
More file actions
69 lines (41 loc) · 1.49 KB
/
bratsPreprocessor.py
File metadata and controls
69 lines (41 loc) · 1.49 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env python3.8
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 1 09:50:09 2023
@author: useradmin
"""
def checkFileFound(file):
try:
f = open(file, 'r')
f.close()
except IOError:
print('file not found')
def main(dirPath, dirName, Flair, T1, T1c, T2):
from brats_toolkit.preprocessor import Preprocessor
# instantiate
prep = Preprocessor()
print("assigning files to variable")
t1File = T1
checkFileFound(t1File)
t1cFile = T1c
checkFileFound(t1cFile)
t2File = T2
checkFileFound(t2File)
flaFile = Flair
checkFileFound(flaFile)
print(t1File, t1cFile, t2File, flaFile)
# define outputs
outputDir = dirPath+"/output"
print(outputDir)
# execute it
prep.single_preprocess(t1File=t1File, t1cFile=t1cFile, t2File=t2File, flaFile=flaFile, outputFolder=outputDir, mode="gpu", confirm=True, skipUpdate=False, gpuid='0')
if __name__ == "__main__":
import sys
print("I am here ............................................",sys.argv[0],"...",sys.argv[1],"...", sys.argv[2],".....\nflair", sys.argv[3], "..\nt1", sys.argv[4], "\nt1c..",sys.argv[5],"\nt2..", sys.argv[6])
examName = sys.argv[2]
print(examName)
f = open(sys.argv[1]+"/bratPreprocesstestout.txt", 'w')
print("file open")
sys.stdout = f
main(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5], sys.argv[6])
#f.close()