@@ -562,13 +562,22 @@ def get_subjectinfo(subject_id, base_dir, task_id, model_id):
562
562
'task%03d_run*' % (idx + 1 ))))
563
563
runs = [int (val [- 3 :]) for val in files ]
564
564
run_ids .insert (idx , runs )
565
- task_scan_key = os .path .join (base_dir , subject_id , 'BOLD' ,
565
+ json_info = os .path .join (base_dir , subject_id , 'BOLD' ,
566
566
'task%03d_run%03d' % (task_id , run_ids [0 ]),
567
- 'scan_key.txt' )
568
- if os .path .exists (task_scan_key ):
569
- TR = np .genfromtxt (task_scan_key )[1 ]
567
+ 'bold_scaninfo.json' )
568
+ if os .path .exists (json_info ):
569
+ import json
570
+ with open (json_info , 'rt' ) as fp :
571
+ data = json .loads (fp )
572
+ TR = data ['global' ]['const' ]['RepetitionTime' ]/ 1000.
570
573
else :
571
- TR = np .genfromtxt (os .path .join (base_dir , 'scan_key.txt' ))[1 ]
574
+ task_scan_key = os .path .join (base_dir , subject_id , 'BOLD' ,
575
+ 'task%03d_run%03d' % (task_id , run_ids [0 ]),
576
+ 'scan_key.txt' )
577
+ if os .path .exists (task_scan_key ):
578
+ TR = np .genfromtxt (task_scan_key )[1 ]
579
+ else :
580
+ TR = np .genfromtxt (os .path .join (base_dir , 'scan_key.txt' ))[1 ]
572
581
return run_ids [task_id - 1 ], conds [task_id - 1 ], TR
573
582
574
583
"""
0 commit comments