From 7c33deb4cdaed9a4ffc4a07bc6ba8d572a9abf83 Mon Sep 17 00:00:00 2001 From: bpinsard Date: Thu, 16 May 2024 14:48:18 -0400 Subject: [PATCH] fix tests, bugs --- smriprep/workflows/anatomical.py | 4 ++-- smriprep/workflows/tests/test_anatomical.py | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/smriprep/workflows/anatomical.py b/smriprep/workflows/anatomical.py index d3bc607bbd..50809638fa 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,7 +1498,7 @@ 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') 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'}, ],