@@ -424,28 +424,33 @@ def init_single_subject_wf(subject_id):
424
424
)
425
425
426
426
if estimator .method == fm .EstimatorType .ANAT :
427
+ from niworkflows .utils .connections import pop_file as _pop
427
428
from sdcflows .interfaces .brainmask import BrainExtraction
428
429
from sdcflows .workflows .fit .syn import init_syn_preprocessing_wf
429
- from ... interfaces .vectors import CheckGradientTable
430
+ from ..interfaces .vectors import CheckGradientTable
430
431
431
- sources = [str (s .path ) for s in estimator .sources ]
432
+ sources = [
433
+ str (s .path ) for s in estimator .sources
434
+ if s .suffix in ("dwi" ,)
435
+ ]
432
436
layout = config .execution .layout
433
437
syn_preprocessing_wf = init_syn_preprocessing_wf (
434
438
omp_nthreads = config .nipype .omp_nthreads ,
435
439
auto_bold_nss = False ,
440
+ t1w_inversion = True ,
441
+ name = f"syn_preprocessing_{ estimator .bids_id } " ,
436
442
)
437
- syn_preprocessing_wf .inputs .in_epis = sources
438
- syn_preprocessing_wf .inputs .in_meta = [
443
+ syn_preprocessing_wf .inputs .inputnode . in_epis = sources
444
+ syn_preprocessing_wf .inputs .inputnode . in_meta = [
439
445
layout .get_metadata (s ) for s in sources
440
446
]
441
-
442
- b0_masks = pe .MapNode (CheckGradientTable (), name = "b0_masks" ,
447
+ b0_masks = pe .MapNode (CheckGradientTable (), name = f"b0_masks_{ estimator .bids_id } " ,
443
448
iterfield = ("dwi_file" , "in_bvec" , "in_bval" ))
444
449
b0_masks .inputs .dwi_file = sources
445
450
b0_masks .inputs .in_bvec = [str (layout .get_bvec (s )) for s in sources ]
446
451
b0_masks .inputs .in_bval = [str (layout .get_bval (s )) for s in sources ]
447
452
448
- epi_brain = pe .Node (BrainExtraction (), name = "epi_brain " )
453
+ epi_brain = pe .Node (BrainExtraction (), name = f"epi_brain_ { estimator . bids_id } " )
449
454
450
455
# fmt:off
451
456
workflow .connect ([
@@ -455,21 +460,17 @@ def init_single_subject_wf(subject_id):
455
460
]),
456
461
(b0_masks , syn_preprocessing_wf , [("b0_mask" , "inputnode.t_masks" )]),
457
462
(syn_preprocessing_wf , fmap_wf , [
458
- ("outputnode.epi_ref" , "inputnode.epi_ref" ),
459
- ("outputnode.anat_ref" , "inputnode.anat_ref" ),
460
- ("outputnode.anat_mask" , "inputnode.anat_mask" ),
461
- ("outputnode.anat2epi_xfm" , "inputnode.anat2epi_xfm" ),
463
+ ("outputnode.epi_ref" , f"in_{ estimator .bids_id } .epi_ref" ),
464
+ ("outputnode.anat_ref" , f"in_{ estimator .bids_id } .anat_ref" ),
465
+ ("outputnode.anat2epi_xfm" , f"in_{ estimator .bids_id } .anat2epi_xfm" ),
462
466
]),
463
- (syn_preprocessing_wf , epi_brain , [("outputnode.epi_ref" , "in_file" )]),
467
+ (syn_preprocessing_wf , epi_brain , [
468
+ (("outputnode.epi_ref" , _pop ), "in_file" )]),
464
469
(anat_preproc_wf , fmap_wf , [
465
- ("outputnode.std2anat_xfm" , "inputnode .std2anat_xfm" ),
470
+ ("outputnode.std2anat_xfm" , f"in_ { estimator . bids_id } .std2anat_xfm" ),
466
471
]),
467
- (epi_brain , fmap_wf , [("out_mask" , "inputnode .epi_mask" )]),
472
+ (epi_brain , fmap_wf , [("out_mask" , f"in_ { estimator . bids_id } .epi_mask" )]),
468
473
])
469
474
# fmt:on
470
475
471
- raise RuntimeError (
472
- f"Unknown fieldmap estimation strategy <{ estimator } >."
473
- )
474
-
475
476
return workflow
0 commit comments