preprocessing
tit.reporting.generators.preprocessing ¶
Preprocessing report generator for TI-Toolbox.
This module provides a report generator for the preprocessing pipeline, creating comprehensive HTML reports with processing steps, input/output data, and quality control information.
PreprocessingReportGenerator ¶
PreprocessingReportGenerator(project_dir: str | Path, subject_id: str, session_id: str | None = None)
Bases: BaseReportGenerator
Report generator for preprocessing pipelines.
Creates comprehensive HTML reports including: - Input data summary - Processing steps with status - Output data summary - Software versions - Quality control visualizations - Methods boilerplate and references
Initialize the preprocessing report generator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_dir
|
str | Path
|
Path to the project directory |
required |
subject_id
|
str
|
BIDS subject ID |
required |
session_id
|
str | None
|
Optional session identifier |
None
|
Source code in tit/reporting/generators/preprocessing.py
set_pipeline_config ¶
Set the pipeline configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**config
|
Pipeline configuration parameters |
{}
|
add_input_data ¶
add_input_data(data_type: str, file_paths: list[str], metadata: dict[str, Any] | None = None) -> None
Add input data information.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_type
|
str
|
Type of data (T1w, T2w, DWI, etc.) |
required |
file_paths
|
list[str]
|
List of input file paths |
required |
metadata
|
dict[str, Any] | None
|
Optional metadata about the data |
None
|
Source code in tit/reporting/generators/preprocessing.py
add_output_data ¶
add_output_data(data_type: str, file_paths: list[str], metadata: dict[str, Any] | None = None) -> None
Add output data information.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_type
|
str
|
Type of data (m2m, FreeSurfer, etc.) |
required |
file_paths
|
list[str]
|
List of output file paths |
required |
metadata
|
dict[str, Any] | None
|
Optional metadata about the data |
None
|
Source code in tit/reporting/generators/preprocessing.py
add_processing_step ¶
add_processing_step(step_name: str, description: str | None = None, parameters: dict[str, Any] | None = None, status: StatusType | str = PENDING, duration: float | None = None, output_files: list[str] | None = None, figures: list[dict[str, Any]] | None = None, error_message: str | None = None) -> None
Add a processing step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step_name
|
str
|
Name of the processing step |
required |
description
|
str | None
|
Step description |
None
|
parameters
|
dict[str, Any] | None
|
Step parameters |
None
|
status
|
StatusType | str
|
Step status |
PENDING
|
duration
|
float | None
|
Duration in seconds |
None
|
output_files
|
list[str] | None
|
Output file paths |
None
|
figures
|
list[dict[str, Any]] | None
|
QC figures |
None
|
error_message
|
str | None
|
Error message if failed |
None
|
Source code in tit/reporting/generators/preprocessing.py
add_qc_image ¶
add_qc_image(title: str, base64_data: str, step_name: str | None = None, caption: str | None = None, image_type: str = 'qc') -> None
Add a quality control image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str
|
Image title |
required |
base64_data
|
str
|
Base64-encoded image data |
required |
step_name
|
str | None
|
Associated processing step |
None
|
caption
|
str | None
|
Image caption |
None
|
image_type
|
str
|
Type of QC image |
'qc'
|
Source code in tit/reporting/generators/preprocessing.py
scan_for_data ¶
Automatically scan directories for input and output data.
Only scans for outputs that correspond to the processing steps that were added to this report.
Source code in tit/reporting/generators/preprocessing.py
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | |
create_preprocessing_report ¶
create_preprocessing_report(project_dir: str | Path, subject_id: str, processing_steps: list[dict[str, Any]] | None = None, output_path: str | Path | None = None, auto_scan: bool = True) -> Path
Convenience function to create a preprocessing report.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_dir
|
str | Path
|
Path to project directory |
required |
subject_id
|
str
|
BIDS subject ID |
required |
processing_steps
|
list[dict[str, Any]] | None
|
List of processing step dictionaries |
None
|
output_path
|
str | Path | None
|
Optional custom output path |
None
|
auto_scan
|
bool
|
Whether to auto-scan for data |
True
|
Returns:
| Type | Description |
|---|---|
Path
|
Path to the generated report |