6767)
6868from nibabies .workflows .bold .base import init_bold_wf
6969
70+ LOGGER = config .loggers .workflow
71+
7072if ty .TYPE_CHECKING :
7173 from bids .layout import BIDSLayout
7274 from niworkflows .utils .spaces import SpatialReferences
@@ -321,7 +323,7 @@ def init_single_subject_wf(
321323 if config .execution .copy_derivatives :
322324 from nibabies .utils .derivatives import copy_derivatives
323325
324- config . loggers . workflow .info ('Copying found anat derivatives into output directory' )
326+ LOGGER .info ('Copying found anat derivatives into output directory' )
325327 copy_derivatives (
326328 derivs = anatomical_cache ,
327329 outdir = config .execution .nibabies_dir ,
@@ -367,7 +369,7 @@ def init_single_subject_wf(
367369
368370 anat = reference_anat .lower () # To be used for workflow connections
369371
370- config . loggers . workflow .info (
372+ LOGGER .info (
371373 'Collected the following data for %s:\n Raw:\n %s\n \n Derivatives:\n \n %s\n ' ,
372374 f'sub-{ subject_id } ' if not session_id else f'sub-{ subject_id } _ses-{ session_id } ' ,
373375 pprint .pformat (subject_data ),
@@ -589,7 +591,7 @@ def init_single_subject_wf(
589591 )
590592
591593 if fmap_estimators :
592- config . loggers . workflow .info (
594+ LOGGER .info (
593595 'B0 field inhomogeneity map will be estimated with the following '
594596 f'{ len (fmap_estimators )} estimator(s): '
595597 f'{ [e .method for e in fmap_estimators ]} .'
@@ -633,7 +635,7 @@ def init_single_subject_wf(
633635 # ]) # fmt:skip
634636
635637 for estimator in fmap_estimators :
636- config . loggers . workflow .info (
638+ LOGGER .info (
637639 f"""\
638640 Setting-up fieldmap "{ estimator .bids_id } " ({ estimator .method } ) with \
639641 <{ ', ' .join (s .path .name for s in estimator .sources )} >"""
@@ -730,9 +732,7 @@ def init_single_subject_wf(
730732 if config .execution .copy_derivatives :
731733 from nibabies .utils .derivatives import copy_derivatives
732734
733- config .loggers .workflow .info (
734- 'Copying found func derivatives into output directory'
735- )
735+ LOGGER .info ('Copying found func derivatives into output directory' )
736736 copy_derivatives (
737737 derivs = functional_cache ,
738738 outdir = config .execution .nibabies_dir ,
@@ -860,6 +860,7 @@ def init_workflow_spaces(execution_spaces: SpatialReferences, age_months: int):
860860 # Ensure age specific template is added if nothing is present
861861 cohort = cohort_by_months ('MNIInfant' , age_months )
862862 spaces .add (('MNIInfant' , {'res' : 'native' , 'cohort' : cohort }))
863+ LOGGER .debug ('No references specified, MNIInfant:cohort-%s as default' , cohort )
863864
864865 if not spaces .is_cached ():
865866 spaces .checkpoint ()
@@ -870,6 +871,7 @@ def init_workflow_spaces(execution_spaces: SpatialReferences, age_months: int):
870871 ):
871872 cohort = cohort_by_months ('MNIInfant' , age_months )
872873 spaces .add (Reference ('MNIInfant' , {'cohort' : cohort }))
874+ LOGGER .debug ('Missing internal space, adding MNIInfant:cohort-%s' , cohort )
873875
874876 if config .workflow .cifti_output :
875877 # CIFTI grayordinates to corresponding FSL-MNI resolutions.
@@ -878,7 +880,14 @@ def init_workflow_spaces(execution_spaces: SpatialReferences, age_months: int):
878880 # Ensure a non-native version of MNIInfant is added as a target
879881 cohort = cohort_by_months ('MNIInfant' , age_months )
880882 spaces .add (Reference ('MNIInfant' , {'cohort' : cohort , 'res' : vol_res }))
883+ LOGGER .debug (
884+ 'Adding MNI152NLin6Asym:res-%s, MNIInfant:cohort-%s:res-%s' ,
885+ vol_res ,
886+ cohort ,
887+ vol_res ,
888+ )
881889
890+ LOGGER .debug ('Workflow spaces: %s' , spaces .get_spaces ())
882891 return spaces
883892
884893
@@ -895,6 +904,7 @@ def init_execution_spaces():
895904 spaces = SpatialReferences (
896905 [ref for s in spaces .split (' ' ) for ref in Reference .from_string (s )]
897906 )
907+ LOGGER .debug ('Execution spaces: %s' , spaces .get_spaces ())
898908 return spaces
899909
900910
@@ -933,20 +943,20 @@ def map_fieldmap_estimation(
933943 'Fieldmap-less (SyN) estimation was requested, but PhaseEncodingDirection '
934944 'information appears to be absent.'
935945 )
936- config . loggers . workflow .error (message )
946+ LOGGER .error (message )
937947 if use_syn == 'error' :
938948 raise ValueError (message )
939949 return [], {}
940950
941951 if ignore_fieldmaps :
942952 if any (f .method == fm .EstimatorType .ANAT for f in fmap_estimators ):
943- config . loggers . workflow .info (
953+ LOGGER .info (
944954 'Option "--ignore fieldmaps" was set, but either "--use-syn-sdc" '
945955 'or "--force-syn" were given, so fieldmap-less estimation will be executed.'
946956 )
947957 fmap_estimators = [f for f in fmap_estimators if f .method == fm .EstimatorType .ANAT ]
948958 else :
949- config . loggers . workflow .info ('Ignoring fieldmaps - no estimators will be used.' )
959+ LOGGER .info ('Ignoring fieldmaps - no estimators will be used.' )
950960 return [], {}
951961
952962 # Pare down estimators to those that are actually used
@@ -961,7 +971,7 @@ def map_fieldmap_estimation(
961971
962972 for bold_file , estimator_key in all_estimators .items ():
963973 if len (estimator_key ) > 1 :
964- config . loggers . workflow .warning (
974+ LOGGER .warning (
965975 f'Several fieldmaps <{ ", " .join (estimator_key )} > are '
966976 f"'IntendedFor' <{ bold_file } >, using { estimator_key [0 ]} "
967977 )
0 commit comments