FreeSurfer: Group Report

Summary

  • Date and time: {{ timestamp }}.
  • Number of subjects: {{ num_subjects }}.
  • Outlier detection threshold: {{ sd_threshold }} standard deviations.
  • {% if groups %}
  • Groups compared: {% for group_name, group_subjects in groups.items() %} {{ group_name }} ({{ group_subjects|length }}){% if not loop.last %}, {% endif %} {% endfor %}
  • Comparison significance threshold: p < {{ alpha }}.
  • {% endif %}

Suspicious / Outlier Subjects

{% if outlier_subjects %}

{{ outlier_subjects|length }} subject(s) flagged as outliers within the cohort.

    {% for subject in outlier_subjects %}
  • {{ subject.subject_id }} ({{ subject.outlier_count }} finding{{ "s" if subject.outlier_count != 1 else "" }})
      {% for finding in subject.findings %}
    • {{ finding }}
    • {% endfor %}
  • {% endfor %}
{% else %}

No outlier subjects detected.

{% endif %}

Quality Summary

{% if quality_summary %} {% set ns = namespace(outliers=0, passed=0, no_data=0, regions=0) %} {% for metric_name, metric_data in quality_summary.items() %} {% for region, result in metric_data.items() %} {% set ns.regions = ns.regions + 1 %} {% if result.status == "outliers_detected" %} {% set ns.outliers = ns.outliers + 1 %} {% elif result.status == "passed" %} {% set ns.passed = ns.passed + 1 %} {% else %} {% set ns.no_data = ns.no_data + 1 %} {% endif %} {% endfor %} {% endfor %}
{{ ns.outliers }} outlier{{ "s" if ns.outliers != 1 else "" }} {{ ns.passed }} passed {% if ns.no_data %} {{ ns.no_data }} no data {% endif %} {{ ns.regions }} regions across {{ quality_summary|length }} metric file{{ "s" if quality_summary|length != 1 else "" }}
{% for metric_name, metric_data in quality_summary.items() %} {% set metric_id = "metric-" ~ loop.index %} {% set metric_outliers = [] %} {% for region, result in metric_data.items() if result.status == "outliers_detected" %} {% if metric_outliers.append(1) %}{% endif %} {% endfor %}

{% for region, result in metric_data.items() %} {% endfor %}
Region Status Mean Std ±{{ sd_threshold }} SD range Details
{{ region }} {% if result.status == "outliers_detected" %} outlier {% elif result.status == "passed" %} passed {% else %} no data {% endif %} {% if result.mean is defined and result.mean is not none %}{{ "%.2f"|format(result.mean) }}{% else %}—{% endif %} {% if result.std is defined and result.std is not none %}{{ "%.2f"|format(result.std) }}{% else %}—{% endif %} {% if result.lower_bound is defined and result.upper_bound is defined and result.lower_bound is not none and result.upper_bound is not none %} {{ "%.2f"|format(result.lower_bound) }} – {{ "%.2f"|format(result.upper_bound) }} {% else %}—{% endif %} {% if result.status == "outliers_detected" %} {{ result.message }} {% if result.outlier_subjects %}
    {% for outlier in result.outlier_subjects %}
  • {{ outlier.subject_id }}: {{ "%.2f"|format(outlier.value) }}
  • {% endfor %}
{% endif %} {% elif result.status == "no_data" %} {{ result.message }} {% else %} — {% endif %}
{% endfor %}
{% else %}

No quality metrics available.

{% endif %}
{% if groups and group_comparison %}

Group Comparison

{% for metric_name, metric_data in group_comparison.items() %}

{{ metric_name.replace('_', ' ').title() }}

{% for region, result in metric_data.items() %}

{{ region }}

    {% for group_name, group_stats in result.items() %} {% if group_name != "comparison" %}
  • {{ group_name }}: n={{ group_stats.n }}{% if group_stats.mean is not none %}, mean={{ "%.2f"|format(group_stats.mean) }}{% endif %}{% if group_stats.std is not none %}, std={{ "%.2f"|format(group_stats.std) }}{% endif %}
  • {% endif %} {% endfor %}
{% if result.comparison and result.comparison.message %}

{{ result.comparison.message }}

{% endif %}
{% endfor %}
{% endfor %}
{% endif %} {% if groups and comparison_plots %}

Group Comparison Plots

{% for plot_html in comparison_plots %}
{{ plot_html|safe }}
{% endfor %}
{% endif %}

Outlier Plots

{% if plots %}
{% for plot_html in plots %}
{{ plot_html|safe }}
{% endfor %}
{% else %}

No plots available.

{% endif %}