From 4ec32829a3c6c60fa081dcdac26e2237559ba4ba Mon Sep 17 00:00:00 2001 From: Taylor Salo Date: Fri, 27 Oct 2023 13:03:18 -0400 Subject: [PATCH] Make registration figure in executive summary optional (#981) --- .readthedocs.yaml | 2 ++ xcp_d/workflows/execsummary.py | 36 +++++++++++++++++++--------------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 953696218..22e7d9858 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -2,6 +2,8 @@ version: 2 build: os: ubuntu-22.04 + apt_packages: + - graphviz tools: python: "3.8" diff --git a/xcp_d/workflows/execsummary.py b/xcp_d/workflows/execsummary.py index eaaf372f5..295c57235 100644 --- a/xcp_d/workflows/execsummary.py +++ b/xcp_d/workflows/execsummary.py @@ -384,24 +384,28 @@ def init_execsummary_functional_plots_wf( suffix="bold", return_type="file", ) - bold_t1w_registration_file = fnmatch.filter( - bold_t1w_registration_files, - f"*/{bb_register_prefix}*", - )[0] + if not bold_t1w_registration_files: + LOGGER.warning("No coregistration figure found in preprocessing derivatives.") + else: + # TODO: Switch to interface + bold_t1w_registration_file = fnmatch.filter( + bold_t1w_registration_files, + f"*/{bb_register_prefix}*", + )[0] - ds_registration_figure = pe.Node( - DerivativesDataSink( - base_directory=output_dir, - in_file=bold_t1w_registration_file, - dismiss_entities=["den"], - datatype="figures", - desc="bbregister", - ), - name="ds_registration_figure", - run_without_submitting=True, - ) + ds_registration_figure = pe.Node( + DerivativesDataSink( + base_directory=output_dir, + in_file=bold_t1w_registration_file, + dismiss_entities=["den"], + datatype="figures", + desc="bbregister", + ), + name="ds_registration_figure", + run_without_submitting=True, + ) - workflow.connect([(inputnode, ds_registration_figure, [("preproc_nifti", "source_file")])]) + workflow.connect([(inputnode, ds_registration_figure, [("preproc_nifti", "source_file")])]) # Calculate the mean bold image calculate_mean_bold = pe.Node(