diff --git a/smriprep/workflows/anatomical.py b/smriprep/workflows/anatomical.py index d3bc607bbd..5b54fb11b7 100644 --- a/smriprep/workflows/anatomical.py +++ b/smriprep/workflows/anatomical.py @@ -1484,7 +1484,7 @@ def init_anat_template_wf( if gradunwarp_file: nds = [ ( - meta.get('NonlinearGradientCorrection', None) + not meta.get('NonlinearGradientCorrection', None) or 'ND' in meta.get('ImageType', []) or False ) @@ -1498,9 +1498,12 @@ def init_anat_template_wf( gradunwarp_file = None if gradunwarp_file: gradunwarp_ver = GradUnwarp.version() - workflow.__desc__ += f"""\ + workflow.__desc__ = ( + (workflow.__desc__ or '') + + f"""\ {"Each" if num_files > 1 else "The"} {contrast} image was corrected for gradient non-linearity with `gradunwarp` [@gradunwarp] {gradunwarp_ver} [@gradunwarp]\n""" + ) gradunwarp_wf = init_gradunwarp_wf('gradunward_T1w') gradunwarp_wf.inputs.inputnode.grad_file = gradunwarp_file # fmt:off diff --git a/smriprep/workflows/tests/test_anatomical.py b/smriprep/workflows/tests/test_anatomical.py index 5ba04a1e27..1df49a7860 100644 --- a/smriprep/workflows/tests/test_anatomical.py +++ b/smriprep/workflows/tests/test_anatomical.py @@ -20,7 +20,11 @@ BASE_LAYOUT = { '01': { 'anat': [ - {'run': 1, 'suffix': 'T1w'}, + { + 'run': 1, + 'suffix': 'T1w', + 'metadata': {'ImageType': ['ND']}, + }, {'run': 2, 'suffix': 'T1w'}, {'suffix': 'T2w'}, ],