File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -107,11 +107,20 @@ def fix_multi_T1w_source_name(in_files):
107
107
... '/path/to/sub-045_ses-retest_T1w.nii.gz'])
108
108
'/path/to/sub-045_T1w.nii.gz'
109
109
110
+
111
+ >>> fix_multi_T1w_source_name([
112
+ ... ('/path/to/sub-045-echo-1_T1w.nii.gz', 'path/to/sub-045-echo-2_T1w.nii.gz')])
113
+ '/path/to/sub-045_T1w.nii.gz'
114
+
110
115
"""
111
116
import os
112
117
from nipype .utils .filemanip import filename_to_list
113
118
114
- base , in_file = os .path .split (filename_to_list (in_files )[0 ])
119
+ in_file = filename_to_list (in_files )[0 ]
120
+ if isinstance (in_file , (list , tuple )):
121
+ in_file = in_file [0 ]
122
+
123
+ base , in_file = os .path .split (in_file )
115
124
subject_label = in_file .split ("_" , 1 )[0 ].split ("-" )[1 ]
116
125
return os .path .join (base , "sub-%s_T1w.nii.gz" % subject_label )
117
126
You can’t perform that action at this time.
0 commit comments