Skip to content

Commit

Permalink
Remove aggr_ses_reports field (#872)
Browse files Browse the repository at this point in the history
* Remove aggr_ses_reports field.

* Remove modality-specific report templates.

* Remove unnecessary variable.
  • Loading branch information
tsalo authored Nov 13, 2024
1 parent 84ed20a commit f670fc3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 246 deletions.
1 change: 0 additions & 1 deletion qsiprep/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,6 @@ class execution(_Config):
"""Write out the computational graph corresponding to the planned preprocessing."""
dataset_links = {}
"""A dictionary of dataset links to be used to track Sources in sidecars."""
aggr_ses_reports = 4

_layout = None

Expand Down
51 changes: 0 additions & 51 deletions qsiprep/data/reports-spec-anat.yml

This file was deleted.

173 changes: 0 additions & 173 deletions qsiprep/data/reports-spec-dwi.yml

This file was deleted.

28 changes: 7 additions & 21 deletions qsiprep/reports/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

from nireports.assembler.report import Report

from .. import config, data
from .. import data


def run_reports(
Expand Down Expand Up @@ -73,25 +73,18 @@ def generate_reports(
----------
output_level {"sessionwise", "unbiased", "first-alphabetically"}
"""

errors = []
for subject_label, session_list in processing_list:

subject_id = subject_label[4:] if subject_label.startswith("sub-") else subject_label
n_ses = len(session_list)

if bootstrap_file is not None:
# If a config file is precised, we do not override it
html_report = "report.html"
elif n_ses <= config.execution.aggr_ses_reports:
else:
# If there are only a few session for this subject,
# we aggregate them in a single visual report.
bootstrap_file = data.load("reports-spec.yml")
html_report = "report.html"
else:
# Beyond a threshold, we separate the anatomical report from the functional.
bootstrap_file = data.load("reports-spec-anat.yml")
html_report = f'sub-{subject_label.lstrip("sub-")}_anat.html'

# We only make this one if it's all the sessions or just the anat and not sessionwise
if output_level != "sessionwise":
Expand All @@ -109,24 +102,17 @@ def generate_reports(
if report_error is not None:
errors.append(report_error)

if n_ses > config.execution.aggr_ses_reports or output_level == "sessionwise":
else:
# Beyond a certain number of sessions per subject,
# we separate the dwi reports per session
# If output_level is "sessionwise",
# the session-wise anatomical reports are in here too
session_list = [ses[4:] if ses.startswith("ses-") else ses for ses in session_list]

for session_label in session_list:

if output_level == "sessionwise":
bootstrap_file = data.load("reports-spec.yml")
suffix = ""
session_dir = output_dir / f"sub-{subject_id}" / f"ses-{session_label}"
html_report = f"sub-{subject_id}_ses-{session_label}.html"
else:
bootstrap_file = data.load("reports-spec-dwi.yml")
suffix = "_dwi"
html_report = "report.html"
bootstrap_file = data.load("reports-spec.yml")
session_dir = output_dir / f"sub-{subject_id}" / f"ses-{session_label}"
html_report = f"sub-{subject_id}_ses-{session_label}.html"

report_error = run_reports(
session_dir,
Expand All @@ -135,7 +121,7 @@ def generate_reports(
bootstrap_file=bootstrap_file,
out_filename=html_report,
reportlets_dir=output_dir,
errorname=f"report-{run_uuid}-{subject_label}-{session_label}{suffix}.err",
errorname=f"report-{run_uuid}-{subject_label}-{session_label}.err",
subject=subject_label,
session=session_label,
)
Expand Down

0 comments on commit f670fc3

Please sign in to comment.