File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -136,6 +136,7 @@ def copy_derivatives(
136
136
modality : str ,
137
137
subject_id : str ,
138
138
session_id : str | None = None ,
139
+ config_hash : str | None = None ,
139
140
) -> None :
140
141
"""
141
142
Creates a copy of any found derivatives into output directory.
@@ -154,8 +155,19 @@ def copy_derivatives(
154
155
if not isinstance (deriv , str ):
155
156
continue
156
157
deriv = Path (deriv )
157
-
158
- shutil .copy2 (deriv , outpath / deriv .name )
158
+ outname = deriv .name
159
+
160
+ if config_hash :
161
+ ents = outname .split ('_' )
162
+ if any (ent .startswith ('hash-' ) for ent in ents ):
163
+ # Avoid adding another hash
164
+ pass
165
+ else :
166
+ idx = 2 if ents [1 ].startswith ('ses-' ) else 1
167
+ ents .insert (idx , f'hash-{ config_hash } ' )
168
+ outname = '_' .join (ents )
169
+
170
+ shutil .copy2 (deriv , outpath / outname )
159
171
json = deriv .parent / (deriv .name .split ('.' )[0 ] + '.json' )
160
172
if json .exists ():
161
173
shutil .copy2 (json , outpath / json .name )
Original file line number Diff line number Diff line change @@ -330,6 +330,9 @@ def init_single_subject_wf(
330
330
modality = 'anat' ,
331
331
subject_id = f'sub-{ subject_id } ' ,
332
332
session_id = f'ses-{ session_id } ' if session_id else None ,
333
+ config_hash = config .execution .parameters_hash
334
+ if config .execution .output_layout == 'multiverse'
335
+ else None ,
333
336
)
334
337
335
338
# Determine some session level options here, as we should have
@@ -738,6 +741,9 @@ def init_single_subject_wf(
738
741
modality = 'func' ,
739
742
subject_id = f'sub-{ subject_id } ' ,
740
743
session_id = f'ses-{ session_id } ' if session_id else None ,
744
+ config_hash = config .execution .parameters_hash
745
+ if config .execution .output_layout == 'multiverse'
746
+ else None ,
741
747
)
742
748
743
749
bold_wf = init_bold_wf (
You can’t perform that action at this time.
0 commit comments