diff --git a/xcp_d/interfaces/report_core.py b/xcp_d/interfaces/report_core.py index 5d1bee8f1..e23b4715b 100644 --- a/xcp_d/interfaces/report_core.py +++ b/xcp_d/interfaces/report_core.py @@ -142,17 +142,27 @@ def generate_reports( else: LOGGER.info("Generating executive summary.") for subject_label in subject_list: - brainplotfile = glob.glob( + brainplotfiles = glob.glob( os.path.join( output_dir, f"xcp_d/sub-{subject_label}", "figures/*_bold.svg", ), - )[0] + ) + if not brainplotfiles: + LOGGER.warning( + "No postprocessing BOLD figures found for subject %s.", + subject_label, + ) + session_id = None + else: + brainplotfile = brainplotfiles[0] + session_id = get_entity(brainplotfile, "ses") + exsumm = ExecutiveSummary( xcpd_path=os.path.join(output_dir, "xcp_d"), subject_id=subject_label, - session_id=get_entity(brainplotfile, "ses"), + session_id=session_id, ) exsumm.collect_inputs() exsumm.generate_report() diff --git a/xcp_d/workflows/base.py b/xcp_d/workflows/base.py index 1963b182f..6b2617e1e 100644 --- a/xcp_d/workflows/base.py +++ b/xcp_d/workflows/base.py @@ -808,6 +808,12 @@ def init_subject_wf( for io_name, node in merge_dict.items(): workflow.connect([(node, concatenate_data_wf, [("out", f"inputnode.{io_name}")])]) + if run_counter == 0: + raise RuntimeError( + f"No runs survived high-motion outlier scrubbing for subject {subject_id}. " + "Quitting workflow." + ) + workflow.connect([ (summary, ds_report_summary, [("out_report", "in_file")]), (about, ds_report_about, [("out_report", "in_file")]),