@@ -546,7 +546,7 @@ def init_single_subject_wf(subject_id: str):
546
546
)
547
547
)
548
548
549
- fmap_estimators , estimator_map = map_fieldmap_estimation (
549
+ all_estimators , estimator_map = map_fieldmap_estimation (
550
550
layout = config .execution .layout ,
551
551
subject_id = subject_id ,
552
552
bold_data = bold_runs ,
@@ -561,15 +561,16 @@ def init_single_subject_wf(subject_id: str):
561
561
for field in ['fmap' , 'fmap_ref' , 'fmap_coeff' , 'fmap_mask' , 'fmap_id' , 'sdc_method' ]
562
562
}
563
563
564
- missing_estimators = []
565
- if fmap_estimators :
566
- # Map fmapid entity to internal bids_id
567
- fmapid_map = {re .sub (r'[^a-zA-Z0-9]' , '' , e .bids_id ): e .bids_id for e in fmap_estimators }
568
- pared_cache = {
569
- fmapid_map [fmapid ]: fmap_cache [fmapid ] for fmapid in fmap_cache if fmapid in fmapid_map
570
- }
571
-
572
- missing_estimators = [e for e in fmap_estimators if e .bids_id not in pared_cache ]
564
+ fmap_estimators = []
565
+ if all_estimators :
566
+ # Find precomputed fieldmaps that apply to this workflow
567
+ pared_cache = {}
568
+ for est in all_estimators :
569
+ fmapid = re .sub (r'[^a-zA-Z0-9]' , '' , est .bids_id )
570
+ if fmapid in fmap_cache :
571
+ pared_cache [fmapid ] = fmap_cache [fmapid ]
572
+ else :
573
+ fmap_estimators .append (est )
573
574
574
575
if pared_cache :
575
576
config .loggers .workflow .info (
@@ -595,11 +596,12 @@ def init_single_subject_wf(subject_id: str):
595
596
fmap_buffers ['fmap_id' ].inputs .in1 = list (pared_cache )
596
597
fmap_buffers ['sdc_method' ].inputs .in1 = ['precomputed' ] * len (pared_cache )
597
598
598
- if missing_estimators :
599
+ # Estimators without precomputed fieldmaps
600
+ if fmap_estimators :
599
601
config .loggers .workflow .info (
600
602
'B0 field inhomogeneity map will be estimated with the following '
601
- f'{ len (missing_estimators )} estimator(s): '
602
- f'{ [e .method for e in missing_estimators ]} .'
603
+ f'{ len (fmap_estimators )} estimator(s): '
604
+ f'{ [e .method for e in fmap_estimators ]} .'
603
605
)
604
606
605
607
from sdcflows import fieldmaps as fm
0 commit comments