group
tit.analyzer.group ¶
Multi-subject group analysis.
Runs per-subject ROI analyses in-process via :class:Analyzer, aggregates the
results into a summary CSV with an AVERAGE row, and produces a 2x2 comparison
bar-chart saved as PDF.
Public API¶
GroupResult Container for multi-subject group analysis outcomes. run_group_analysis Run the same ROI analysis across multiple subjects and summarise.
See Also¶
tit.analyzer.analyzer : Single-subject analyzer used per-subject.
GroupResult
dataclass
¶
GroupResult(subject_results: dict[str, AnalysisResult], summary_csv_path: Path, comparison_plot_path: Path | None)
Outcome of a multi-subject group analysis.
Attributes¶
subject_results : dict of str to AnalysisResult
Mapping of subject ID to its
:class:~tit.analyzer.analyzer.AnalysisResult.
summary_csv_path : pathlib.Path
Path to the summary CSV (one row per subject plus an AVERAGE row).
comparison_plot_path : pathlib.Path or None
Path to the 2x2 comparison bar-chart PDF, or None if plotting
failed.
See Also¶
run_group_analysis : Factory function that produces this result. AnalysisResult : Per-subject analysis container.
run_group_analysis ¶
run_group_analysis(subject_ids: list[str], simulation: str, space: str = 'mesh', tissue_type: str = 'GM', analysis_type: str = 'spherical', center: tuple[float, float, float] | None = None, radius: float | None = None, coordinate_space: str = 'subject', atlas: str | None = None, region: str | list[str] | None = None, visualize: bool = False, output_dir: str | Path | None = None) -> GroupResult
Run the same ROI analysis across multiple subjects and summarise.
Dispatches to analyze_sphere or analyze_cortex on each subject,
builds a summary CSV (with an AVERAGE row), and generates a 2x2
comparison bar-chart PDF.
Parameters¶
subject_ids : list of str
Subject identifiers (without sub- prefix).
simulation : str
Simulation (montage) folder name, shared by all subjects.
space : str, optional
"mesh" or "voxel". Default "mesh".
tissue_type : str, optional
"GM", "WM", or "both" (voxel only). Default "GM".
analysis_type : str, optional
"spherical" or "cortical". Default "spherical".
center : tuple of float or None, optional
(x, y, z) sphere centre; required when analysis_type is
"spherical".
radius : float or None, optional
Sphere radius in mm; required when analysis_type is
"spherical".
coordinate_space : str, optional
"subject" or "MNI" (spherical only). Default "subject".
atlas : str or None, optional
Atlas name (cortical only).
region : str, list of str, or None, optional
Region name or list of region names (cortical only).
visualize : bool, optional
Generate per-subject visualization artifacts. Default False.
output_dir : str, pathlib.Path, or None, optional
Override output directory. If None, derived from PathManager.
Returns¶
GroupResult Per-subject results, the summary CSV path, and the comparison plot path.
Raises¶
KeyError
If analysis_type is not "spherical" or "cortical".
See Also¶
Analyzer : Single-subject analyzer used internally per subject. GroupResult : Container for the returned outcomes.
Source code in tit/analyzer/group.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | |