Skip to content

Commit

Permalink
enh: adapt the call to Report to its nireports implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
celprov committed Dec 13, 2023
1 parent 9d9b217 commit 60a04df
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions fmriprep/reports/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -53,8 +53,7 @@ def _load_config(self, config):
#

def generate_reports(
subject_list, output_dir, run_uuid, config=None, work_dir=None, packagename=None
):
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:
Expand All @@ -63,11 +62,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,
Expand All @@ -80,11 +76,13 @@ def generate_reports(
**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

Expand Down

0 comments on commit 60a04df

Please sign in to comment.