@@ -21,17 +21,26 @@ def get_bids_subject_input_files(subject_id, bids_input_directory):
21
21
subjects = layout .get_subjects ()
22
22
assert subject_id in subjects , "subject {} is not in the bids folder" .format (subject_id )
23
23
24
- ap_file = layout .get (subject = subject_id , fmap = "epi" , modality = "fmap" , dir = "AP" )
24
+ ap_file = layout .get (subject = subject_id ,
25
+ datatype = 'fmap' ,
26
+ suffix = 'epi' ,
27
+ dir = 'AP' ,
28
+ extensions = ['.nii' , '.nii.gz' ])
25
29
assert len (ap_file ) == 1 , 'found {} ap fieldmap files and we need just 1' .format (len (ap_file ))
26
30
27
- pa_file = layout .get (subject = subject_id , fmap = "epi" , modality = "fmap" , dir = "PA" )
31
+ pa_file = layout .get (subject = subject_id ,
32
+ datatype = 'fmap' ,
33
+ suffix = 'epi' ,
34
+ dir = 'PA' ,
35
+ extensions = ['.nii' , '.nii.gz' ])
36
+
28
37
assert len (pa_file ) == 1 , 'found {} pa fieldmap files and we need just 1' .format (len (pa_file ))
29
38
30
- dwi_files = layout .get (subject = subject_id , modality = " dwi" )
39
+ dwi_files = layout .get (subject = subject_id , datatype = ' dwi' , suffix = 'dwi' )
31
40
valid_dwi_files = []
32
41
33
42
for d in dwi_files :
34
- if d .filename .startswith (op .abspath (op .join (bids_input_directory , 'sub-' + subject_id ))):
43
+ if d .path .startswith (op .abspath (op .join (bids_input_directory , 'sub-' + subject_id ))):
35
44
valid_dwi_files .append (d .filename )
36
45
37
46
dwi_file = [d for d in valid_dwi_files if d .endswith ('.nii.gz' ) and not "TRACE" in d ]
@@ -52,8 +61,8 @@ def get_bids_subject_input_files(subject_id, bids_input_directory):
52
61
53
62
outputs = dict (subject_id = "sub-" + subject_id ,
54
63
dwi_file = dwi_file [0 ],
55
- dwi_file_AP = ap_file [0 ].filename ,
56
- dwi_file_PA = pa_file [0 ].filename ,
64
+ dwi_file_AP = ap_file [0 ].path ,
65
+ dwi_file_PA = pa_file [0 ].path ,
57
66
bvec_file = bvec_file [0 ],
58
67
bval_file = bval_file [0 ],
59
68
subjects_dir = op .abspath (subjects_dir ))
0 commit comments