https://github.com/samsydco/HBN
Raw File
Tip revision: 7161591e3032afc987821f6fd80181a20976aec2 authored by Samantha Cohen on 16 August 2022, 18:12:06 UTC
Merge branch 'master' of https://github.com/samsydco/HBN
Tip revision: 7161591
2_RA_rating.py
#!/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])





back to top