forked from samsydco/HBN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2_RA_rating.py
executable file
·53 lines (42 loc) · 1.24 KB
/
2_RA_rating.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
41
42
43
44
45
46
47
48
#!/usr/bin/env python3
import subprocess as sp
import glob
import csv
import os
from settings import *
site = 'Site-CBIC'
#site = 'Site-RU'
# Right now all RAs should have already entered their information:
while True:
initials = input("Please type your initials - should be same two letters every time you come to lab.")
T1file = path+codedr+'T1_rating/'+initials+'_'+site+"_T1.csv"
if not glob.glob(path+codedr+'T1_rating/'+initials+'_*'):
print("You used different initials last time!")
continue
else:
break
# If T1file exists, import info, if not, create it
if os.path.exists(T1file):
with open(T1file,'r') as f:
r = csv.reader(f)
T1dict = {rows[0]:rows[1] for rows in r}
else:
T1dict = {}
if site == 'Site-CBIC':
path = path + site + '/'
subs = glob.glob('%ssub*'%(path))
print('You have %s scans left.'%(len(subs) - len(T1dict)))
for sub in subs:
sub_temp = sub.replace(path,"")
if sub_temp not in T1dict:
# Look at T1's in fsleyes pause, do fmriprep if ok
sp.run(["fsleyes","%s/anat/%s_acq-HCP_T1w.nii.gz"%(sub,sub_temp)])
yesno = yesnofun(sub)
if yesno in ['y','n','m']:
T1dict[sub_temp] = yesno
else:
break
with open(T1file,'a') as f:
w = csv.writer(f)
# TEST THIS!
w.writerow([sub_temp,yesno])