@@ -176,7 +176,6 @@ def init_single_subject_wf(
176
176
from niworkflows .interfaces .nilearn import NILEARN_VERSION
177
177
from niworkflows .interfaces .utility import KeySelect
178
178
from niworkflows .utils .bids import collect_data
179
- from niworkflows .utils .misc import fix_multi_T1w_source_name
180
179
from niworkflows .utils .spaces import Reference
181
180
from smriprep .workflows .anatomical import init_anat_fit_wf
182
181
from smriprep .workflows .outputs import (
@@ -193,6 +192,7 @@ def init_single_subject_wf(
193
192
)
194
193
195
194
from fmriprep .workflows .bold .base import init_bold_wf
195
+ from fmriprep .interfaces .bids import BIDSSourceFile , CreateFreeSurferID
196
196
197
197
if name is None :
198
198
name = f'sub_{ subject_id } _wf'
@@ -300,10 +300,20 @@ def init_single_subject_wf(
300
300
name = 'bidssrc' ,
301
301
)
302
302
303
+ src_file = pe .Node (
304
+ BIDSSourceFile (
305
+ precomputed = anatomical_cache ,
306
+ sessionwise = config .workflow .subject_anatomical_reference == 'sessionwise' ,
307
+ ),
308
+ name = 'source_anatomical' ,
309
+ )
310
+
303
311
bids_info = pe .Node (
304
312
BIDSInfo (bids_dir = config .execution .bids_dir , bids_validate = False ), name = 'bids_info'
305
313
)
306
314
315
+ create_fs_id = pe .Node (CreateFreeSurferID (), name = 'create_fs_id' )
316
+
307
317
summary = pe .Node (
308
318
SubjectSummary (
309
319
std_spaces = spaces .get_spaces (nonstandard = False ),
@@ -372,17 +382,15 @@ def init_single_subject_wf(
372
382
'No T1w image found; using precomputed T1w image: %s' , anatomical_cache ['t1w_preproc' ]
373
383
)
374
384
workflow .connect ([
375
- (bidssrc , bids_info , [(('bold' , fix_multi_T1w_source_name ), 'in_file' )]),
376
385
(anat_fit_wf , summary , [('outputnode.t1w_preproc' , 't1w' )]),
377
386
(anat_fit_wf , ds_report_summary , [('outputnode.t1w_preproc' , 'source_file' )]),
378
387
(anat_fit_wf , ds_report_about , [('outputnode.t1w_preproc' , 'source_file' )]),
379
388
]) # fmt:skip
380
389
else :
381
390
workflow .connect ([
382
- (bidssrc , bids_info , [(('t1w' , fix_multi_T1w_source_name ), 'in_file' )]),
383
- (bidssrc , summary , [('t1w' , 't1w' )]),
384
- (bidssrc , ds_report_summary , [(('t1w' , fix_multi_T1w_source_name ), 'source_file' )]),
385
- (bidssrc , ds_report_about , [(('t1w' , fix_multi_T1w_source_name ), 'source_file' )]),
391
+ (src_file , summary , [('source_file' , 't1w' )]),
392
+ (src_file , ds_report_summary , [('source_file' , 'source_file' )]),
393
+ (src_file , ds_report_about , [('source_file' , 'source_file' )]),
386
394
]) # fmt:skip
387
395
388
396
workflow .connect ([
@@ -393,7 +401,13 @@ def init_single_subject_wf(
393
401
('roi' , 'inputnode.roi' ),
394
402
('flair' , 'inputnode.flair' ),
395
403
]),
396
- (bids_info , anat_fit_wf , [(('subject' , _prefix , 'session' ), 'inputnode.subject_id' )]),
404
+ (bidssrc , src_file , [('out_dict' , 'bids_info' )]),
405
+ (src_file , bids_info , [('source_file' , 'in_file' )]),
406
+ (bids_info , create_fs_id , [
407
+ ('subject' , 'subject_id' ),
408
+ ('session' , 'session_id' ),
409
+ ]),
410
+ (create_fs_id , anat_fit_wf , [('subject_id' , 'inputnode.subject_id' )]),
397
411
# Reporting connections
398
412
(inputnode , summary , [('subjects_dir' , 'subjects_dir' )]),
399
413
(bidssrc , summary , [('t2w' , 't2w' ), ('bold' , 'bold' )]),
@@ -959,23 +973,6 @@ def map_fieldmap_estimation(
959
973
return fmap_estimators , estimator_map
960
974
961
975
962
- def _prefix (subject_id , session_id = None ):
963
- """Create FreeSurfer subject ID."""
964
- if not subject_id .startswith ('sub-' ):
965
- subject_id = f'sub-{ subject_id } '
966
-
967
- if session_id :
968
- ses_str = session_id
969
- if isinstance (session_id , list ):
970
- from smriprep .utils .misc import stringify_sessions
971
-
972
- ses_str = stringify_sessions (session_id )
973
- if not ses_str .startswith ('ses-' ):
974
- ses_str = f'ses-{ ses_str } '
975
- subject_id += f'_{ ses_str } '
976
- return subject_id
977
-
978
-
979
976
def clean_datasinks (workflow : pe .Workflow ) -> pe .Workflow :
980
977
# Overwrite ``out_path_base`` of smriprep's DataSinks
981
978
for node in workflow .list_node_names ():
0 commit comments