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(
136136 modality : str ,
137137 subject_id : str ,
138138 session_id : str | None = None ,
139+ config_hash : str | None = None ,
139140) -> None :
140141 """
141142 Creates a copy of any found derivatives into output directory.
@@ -154,8 +155,19 @@ def copy_derivatives(
154155 if not isinstance (deriv , str ):
155156 continue
156157 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 )
159171 json = deriv .parent / (deriv .name .split ('.' )[0 ] + '.json' )
160172 if json .exists ():
161173 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(
330330 modality = 'anat' ,
331331 subject_id = f'sub-{ subject_id } ' ,
332332 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 ,
333336 )
334337
335338 # Determine some session level options here, as we should have
@@ -738,6 +741,9 @@ def init_single_subject_wf(
738741 modality = 'func' ,
739742 subject_id = f'sub-{ subject_id } ' ,
740743 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 ,
741747 )
742748
743749 bold_wf = init_bold_wf (
You can’t perform that action at this time.
0 commit comments