| Title: | PDF Reporting for fMRI GLM Fits |
|---|---|
| Description: | Generates publication-oriented PDF reports for fitted fMRI GLM models from 'fmrireg'. Reports include model/design summaries, HRF plots, coefficient summaries, contrast brain maps, and peak coordinate tables. |
| Authors: | Bradley Buchsbaum [aut, cre] |
| Maintainer: | Bradley Buchsbaum <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 0.1.0 |
| Built: | 2026-06-02 22:54:31 UTC |
| Source: | https://github.com/bbuchsbaum/fmrireport |
Produces a flat data.frame suitable for table rendering. Cluster rows have
all columns populated; sub-peak rows have k and volume_mm3
set to NA.
## S3 method for class 'cluster_table' as.data.frame( x, row.names = NULL, optional = FALSE, max_clusters = 30L, max_sub_peaks = 3L, ... )## S3 method for class 'cluster_table' as.data.frame( x, row.names = NULL, optional = FALSE, max_clusters = 30L, max_sub_peaks = 3L, ... )
x |
A |
row.names |
Ignored. |
optional |
Ignored. |
max_clusters |
Maximum clusters to include. |
max_sub_peaks |
Maximum sub-peaks per cluster. |
... |
Ignored. |
A data.frame.
Detects suprathreshold clusters in a statistical brain volume and returns a structured table of cluster-level and peak-level statistics suitable for publication (NeuroImage / HBM / COBIDAS compliant).
cluster_table( vol, threshold, atlas = NULL, stat_type = c("t", "z", "F", "other"), df = NULL, coord_space = NULL, min_cluster_size = 10L, local_maxima_dist = 15, max_peaks = 3L, connectivity = c("26-connect", "18-connect", "6-connect"), sort_by = c("size", "peak_stat") )cluster_table( vol, threshold, atlas = NULL, stat_type = c("t", "z", "F", "other"), df = NULL, coord_space = NULL, min_cluster_size = 10L, local_maxima_dist = 15, max_peaks = 3L, connectivity = c("26-connect", "18-connect", "6-connect"), sort_by = c("size", "peak_stat") )
vol |
A |
threshold |
Numeric threshold for cluster detection (absolute value). |
atlas |
Optional atlas object (e.g., a |
stat_type |
Type of statistic in the volume: |
df |
Degrees of freedom for p-value computation. A single value for
t/z statistics, or a length-2 vector |
coord_space |
Character string naming the coordinate space (e.g.,
|
min_cluster_size |
Minimum number of voxels for a cluster to be retained. |
local_maxima_dist |
Minimum distance (mm) between local maxima within a cluster. |
max_peaks |
Maximum number of sub-peaks reported per cluster. |
connectivity |
Voxel connectivity for cluster detection. |
sort_by |
Sort clusters by |
An S3 object of class "cluster_table" with elements:
A data.frame with one row per cluster.
A data.frame with sub-peaks (local maxima) per cluster.
The threshold used.
The statistic type.
Degrees of freedom.
Number of clusters.
Coordinate space label.
Name of atlas used, or NA.
Returns a tinytable::tt() object with appropriate caption and
formatting for Quarto/Typst rendering.
format_cluster_tt(x, max_clusters = 30L, max_sub_peaks = 3L, digits = 3L, ...)format_cluster_tt(x, max_clusters = 30L, max_sub_peaks = 3L, digits = 3L, ...)
x |
A |
max_clusters |
Maximum clusters to include. |
max_sub_peaks |
Maximum sub-peaks per cluster. |
digits |
Number of digits for rounding numeric columns. |
... |
Passed to |
A tinytable object.
CLI-formatted hierarchical output showing clusters with sub-peaks indented.
## S3 method for class 'cluster_table' print(x, max_clusters = 20L, max_sub_peaks = 3L, ...)## S3 method for class 'cluster_table' print(x, max_clusters = 20L, max_sub_peaks = 3L, ...)
x |
A |
max_clusters |
Maximum number of clusters to display. |
max_sub_peaks |
Maximum sub-peaks per cluster to display. |
... |
Ignored. |
Invisibly returns x.
Generic report interface and fmri_lm implementation that renders a
publication-style PDF report through Quarto.
report(x, ...) ## Default S3 method: report(x, ...) ## S3 method for class 'fmri_lm' report( x, output_file = "fmri_lm_report.pdf", title = "fMRI GLM Analysis Report", author = NULL, sections = c("model", "design", "hrf", "estimates", "contrasts", "diagnostics"), brain_map_stat = c("tstat", "estimate", "prob"), slice_axis = 3L, n_slices = 9L, threshold = NULL, bg_vol = NULL, atlas = NULL, cluster_thresh = 3, min_cluster_size = 10L, max_peaks = 15L, local_maxima_dist = 15, max_sub_peaks = 3L, open = interactive(), quiet = TRUE, ... )report(x, ...) ## Default S3 method: report(x, ...) ## S3 method for class 'fmri_lm' report( x, output_file = "fmri_lm_report.pdf", title = "fMRI GLM Analysis Report", author = NULL, sections = c("model", "design", "hrf", "estimates", "contrasts", "diagnostics"), brain_map_stat = c("tstat", "estimate", "prob"), slice_axis = 3L, n_slices = 9L, threshold = NULL, bg_vol = NULL, atlas = NULL, cluster_thresh = 3, min_cluster_size = 10L, max_peaks = 15L, local_maxima_dist = 15, max_sub_peaks = 3L, open = interactive(), quiet = TRUE, ... )
x |
Object to report on. |
... |
Additional arguments passed to methods. |
output_file |
Output PDF path. |
title |
Report title. |
author |
Optional author string. |
sections |
Sections to include. |
brain_map_stat |
Statistic for contrast maps: |
slice_axis |
Axis for montage slicing (1, 2, or 3). |
n_slices |
Number of slices to render in contrast maps. |
threshold |
Optional hard threshold for contrast map rendering. |
bg_vol |
Optional background |
atlas |
Optional atlas object for peak labeling. |
cluster_thresh |
Absolute statistic threshold for peak clustering. |
min_cluster_size |
Minimum cluster size (voxels) in peak table. |
max_peaks |
Maximum peaks per contrast table. |
local_maxima_dist |
Minimum distance (mm) between local maxima within a cluster for sub-peak detection. Default 15. |
max_sub_peaks |
Maximum number of sub-peaks per cluster in the activation table. Default 3. |
open |
If |
quiet |
If |
Method-specific report output. For fmri_lm fits, returns the output PDF
path invisibly.