67
67
)
68
68
from nibabies .workflows .bold .base import init_bold_wf
69
69
70
+ LOGGER = config .loggers .workflow
71
+
70
72
if ty .TYPE_CHECKING :
71
73
from bids .layout import BIDSLayout
72
74
from niworkflows .utils .spaces import SpatialReferences
@@ -321,7 +323,7 @@ def init_single_subject_wf(
321
323
if config .execution .copy_derivatives :
322
324
from nibabies .utils .derivatives import copy_derivatives
323
325
324
- config . loggers . workflow .info ('Copying found anat derivatives into output directory' )
326
+ LOGGER .info ('Copying found anat derivatives into output directory' )
325
327
copy_derivatives (
326
328
derivs = anatomical_cache ,
327
329
outdir = config .execution .nibabies_dir ,
@@ -367,7 +369,7 @@ def init_single_subject_wf(
367
369
368
370
anat = reference_anat .lower () # To be used for workflow connections
369
371
370
- config . loggers . workflow .info (
372
+ LOGGER .info (
371
373
'Collected the following data for %s:\n Raw:\n %s\n \n Derivatives:\n \n %s\n ' ,
372
374
f'sub-{ subject_id } ' if not session_id else f'sub-{ subject_id } _ses-{ session_id } ' ,
373
375
pprint .pformat (subject_data ),
@@ -589,7 +591,7 @@ def init_single_subject_wf(
589
591
)
590
592
591
593
if fmap_estimators :
592
- config . loggers . workflow .info (
594
+ LOGGER .info (
593
595
'B0 field inhomogeneity map will be estimated with the following '
594
596
f'{ len (fmap_estimators )} estimator(s): '
595
597
f'{ [e .method for e in fmap_estimators ]} .'
@@ -633,7 +635,7 @@ def init_single_subject_wf(
633
635
# ]) # fmt:skip
634
636
635
637
for estimator in fmap_estimators :
636
- config . loggers . workflow .info (
638
+ LOGGER .info (
637
639
f"""\
638
640
Setting-up fieldmap "{ estimator .bids_id } " ({ estimator .method } ) with \
639
641
<{ ', ' .join (s .path .name for s in estimator .sources )} >"""
@@ -730,9 +732,7 @@ def init_single_subject_wf(
730
732
if config .execution .copy_derivatives :
731
733
from nibabies .utils .derivatives import copy_derivatives
732
734
733
- config .loggers .workflow .info (
734
- 'Copying found func derivatives into output directory'
735
- )
735
+ LOGGER .info ('Copying found func derivatives into output directory' )
736
736
copy_derivatives (
737
737
derivs = functional_cache ,
738
738
outdir = config .execution .nibabies_dir ,
@@ -860,6 +860,7 @@ def init_workflow_spaces(execution_spaces: SpatialReferences, age_months: int):
860
860
# Ensure age specific template is added if nothing is present
861
861
cohort = cohort_by_months ('MNIInfant' , age_months )
862
862
spaces .add (('MNIInfant' , {'res' : 'native' , 'cohort' : cohort }))
863
+ LOGGER .debug ('No references specified, MNIInfant:cohort-%s as default' , cohort )
863
864
864
865
if not spaces .is_cached ():
865
866
spaces .checkpoint ()
@@ -870,6 +871,7 @@ def init_workflow_spaces(execution_spaces: SpatialReferences, age_months: int):
870
871
):
871
872
cohort = cohort_by_months ('MNIInfant' , age_months )
872
873
spaces .add (Reference ('MNIInfant' , {'cohort' : cohort }))
874
+ LOGGER .debug ('Missing internal space, adding MNIInfant:cohort-%s' , cohort )
873
875
874
876
if config .workflow .cifti_output :
875
877
# CIFTI grayordinates to corresponding FSL-MNI resolutions.
@@ -878,7 +880,14 @@ def init_workflow_spaces(execution_spaces: SpatialReferences, age_months: int):
878
880
# Ensure a non-native version of MNIInfant is added as a target
879
881
cohort = cohort_by_months ('MNIInfant' , age_months )
880
882
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
+ )
881
889
890
+ LOGGER .debug ('Workflow spaces: %s' , spaces .get_spaces ())
882
891
return spaces
883
892
884
893
@@ -895,6 +904,7 @@ def init_execution_spaces():
895
904
spaces = SpatialReferences (
896
905
[ref for s in spaces .split (' ' ) for ref in Reference .from_string (s )]
897
906
)
907
+ LOGGER .debug ('Execution spaces: %s' , spaces .get_spaces ())
898
908
return spaces
899
909
900
910
@@ -933,20 +943,20 @@ def map_fieldmap_estimation(
933
943
'Fieldmap-less (SyN) estimation was requested, but PhaseEncodingDirection '
934
944
'information appears to be absent.'
935
945
)
936
- config . loggers . workflow .error (message )
946
+ LOGGER .error (message )
937
947
if use_syn == 'error' :
938
948
raise ValueError (message )
939
949
return [], {}
940
950
941
951
if ignore_fieldmaps :
942
952
if any (f .method == fm .EstimatorType .ANAT for f in fmap_estimators ):
943
- config . loggers . workflow .info (
953
+ LOGGER .info (
944
954
'Option "--ignore fieldmaps" was set, but either "--use-syn-sdc" '
945
955
'or "--force-syn" were given, so fieldmap-less estimation will be executed.'
946
956
)
947
957
fmap_estimators = [f for f in fmap_estimators if f .method == fm .EstimatorType .ANAT ]
948
958
else :
949
- config . loggers . workflow .info ('Ignoring fieldmaps - no estimators will be used.' )
959
+ LOGGER .info ('Ignoring fieldmaps - no estimators will be used.' )
950
960
return [], {}
951
961
952
962
# Pare down estimators to those that are actually used
@@ -961,7 +971,7 @@ def map_fieldmap_estimation(
961
971
962
972
for bold_file , estimator_key in all_estimators .items ():
963
973
if len (estimator_key ) > 1 :
964
- config . loggers . workflow .warning (
974
+ LOGGER .warning (
965
975
f'Several fieldmaps <{ ", " .join (estimator_key )} > are '
966
976
f"'IntendedFor' <{ bold_file } >, using { estimator_key [0 ]} "
967
977
)
0 commit comments