-
Notifications
You must be signed in to change notification settings - Fork 1
/
check_antsReg_outputs.py
executable file
·36 lines (29 loc) · 1.12 KB
/
check_antsReg_outputs.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
#! /usr/bin/env python
from glob import glob
from nipype.utils.filemanip import load_json, save_json
import os
import pandas as pd
if __name__ == '__main__':
outdir = '/data/henry7/PBR/subjects/'
df = pd.read_csv("/data/henry7/james/antje_cohort/no_qb3_antje_transition_cohort.csv")
msid_set = set(df['msid'])
msid_set_sorted = sorted(list(msid_set))
print("msid scanned are :", msid_set_sorted)
check = {}
check['not_run_yet'] = []
check['need_rerun'] = []
check['finished'] = []
for msid in msid_set_sorted:
check_status = glob(os.path.join(outdir, msid, 't1Ants_reg_long', 'status.json'))
if len(check_status) == 0:
check['not_run_yet'].append(msid)
else:
print(check_status)
check_status = ''.join(check_status)
status = load_json(check_status)
if len(status['mseIDs']) == len(status['fixed_image']) + 1:
check['finished'].append(msid)
else:
check['need_rerun'].append(msid)
print(check)
save_json('/data/henry7/james/antje_cohort/check_pbr_outputs.json', check)