diff --git a/fmriprep/reports/core.py b/fmriprep/reports/core.py index 918d21c27..66074e16f 100644 --- a/fmriprep/reports/core.py +++ b/fmriprep/reports/core.py @@ -22,7 +22,7 @@ # from pathlib import Path -from nireports.reports.core import Report as _Report +from nireports.assembler.report import Report as _Report # This patch is intended to permit fMRIPrep 20.2.0 LTS to use the YODA-style # derivatives directory. Ideally, we will remove this in 20.3.x and use an @@ -52,9 +52,8 @@ def _load_config(self, config): # The following are the interface used directly by fMRIPrep # -def generate_reports( - subject_list, output_dir, run_uuid, config=None, work_dir=None, packagename=None -): + +def generate_reports(subject_list, output_dir, run_uuid, config=None, work_dir=None): """Generate reports for a list of subjects.""" reportlets_dir = None if work_dir is not None: @@ -62,12 +61,8 @@ def generate_reports( report_errors = [] for subject_label in subject_list: - - # Problem subject_label is not a path to a file, I think - entities = config.execution.layout.get_file(subject_label).get_entities() - entities.pop("extension", None) - entities.pop("echo", None) - entities.pop("part", None) + entities = {} + entities["sub"] = subject_label robj = Report( output_dir, @@ -77,14 +72,16 @@ def generate_reports( plugins=None, plugin_meta=None, metadata=None, - **entities + **entities, ) - # Problem: this does not make sense anymore because generate_report in nireports always returns 0 - report_errors.append(robj.generate_report()) - + # Count nbr of subject for which report generation failed + errno = 0 + try: + robj.generate_report() + except: + errno += 1 - errno = sum(report_errors) if errno: import logging