reportlets
tit.reporting.reportlets ¶
Specialized reportlets for TI-Toolbox reports.
This module provides domain-specific reportlets for brain imaging, simulation parameters, and analysis results.
SliceSeriesReportlet ¶
SliceSeriesReportlet(title: str | None = None, slices: list[dict[str, Any]] | None = None, orientation: str = 'axial', caption: str | None = None)
Bases: BaseReportlet
Reportlet for displaying a series of brain slices.
Displays multiple slices (typically 7) across axial, sagittal, or coronal views, commonly used for QC visualizations.
Initialize the slice series reportlet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str | None
|
Title for the slice series |
None
|
slices
|
list[dict[str, Any]] | None
|
List of slice data dicts with 'base64' and optional 'label' |
None
|
orientation
|
str
|
View orientation (axial, sagittal, coronal) |
'axial'
|
caption
|
str | None
|
Optional caption text |
None
|
Source code in tit/reporting/reportlets/images.py
add_slice ¶
add_slice(image_data: str | bytes | Path | Any, label: str | None = None, mime_type: str = 'image/png') -> None
Add a slice to the series.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image_data
|
str | bytes | Path | Any
|
Base64 string, bytes, path, or PIL Image |
required |
label
|
str | None
|
Optional label for this slice |
None
|
mime_type
|
str
|
MIME type of the image |
'image/png'
|
Source code in tit/reporting/reportlets/images.py
load_from_files ¶
render_html ¶
render_html() -> str
Render the slice series as HTML.
Source code in tit/reporting/reportlets/images.py
MontageImageReportlet ¶
MontageImageReportlet(title: str | None = None, image_source: str | Path | bytes | Any | None = None, electrode_pairs: list[dict[str, Any]] | None = None, montage_name: str | None = None)
Bases: BaseReportlet
Reportlet for displaying electrode montage visualizations.
Shows electrode placement with labeled pairs and optional intensity annotations.
Initialize the montage image reportlet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str | None
|
Title for the montage |
None
|
image_source
|
str | Path | bytes | Any | None
|
Montage image (path, bytes, or PIL Image) |
None
|
electrode_pairs
|
list[dict[str, Any]] | None
|
List of electrode pair configurations |
None
|
montage_name
|
str | None
|
Name of the montage |
None
|
Source code in tit/reporting/reportlets/images.py
set_base64_data ¶
add_electrode_pair ¶
add_electrode_pair(name: str, electrode1: str, electrode2: str, intensity: float | None = None) -> None
Add an electrode pair to the montage info.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of the pair (e.g., "Pair 1") |
required |
electrode1
|
str
|
First electrode position |
required |
electrode2
|
str
|
Second electrode position |
required |
intensity
|
float | None
|
Optional current intensity |
None
|
Source code in tit/reporting/reportlets/images.py
render_html ¶
render_html() -> str
Render the montage image as HTML.
Source code in tit/reporting/reportlets/images.py
MultiViewBrainReportlet ¶
MultiViewBrainReportlet(title: str | None = None, axial_image: str | Path | bytes | None = None, sagittal_image: str | Path | bytes | None = None, coronal_image: str | Path | bytes | None = None, caption: str | None = None)
Bases: BaseReportlet
Reportlet for displaying brain images in multiple views.
Shows the same brain data in axial, sagittal, and coronal orientations side by side.
Initialize the multi-view brain reportlet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str | None
|
Title for the visualization |
None
|
axial_image
|
str | Path | bytes | None
|
Axial view image |
None
|
sagittal_image
|
str | Path | bytes | None
|
Sagittal view image |
None
|
coronal_image
|
str | Path | bytes | None
|
Coronal view image |
None
|
caption
|
str | None
|
Optional caption |
None
|
Source code in tit/reporting/reportlets/images.py
set_view ¶
Set an image for a specific view.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view_name
|
str
|
One of 'axial', 'sagittal', 'coronal' |
required |
image_data
|
str | Path | bytes | Any
|
Image data (path, bytes, base64, or PIL Image) |
required |
Source code in tit/reporting/reportlets/images.py
render_html ¶
render_html() -> str
Render the multi-view visualization as HTML.
Source code in tit/reporting/reportlets/images.py
ConductivityTableReportlet ¶
ConductivityTableReportlet(conductivities: dict[str, dict[str, Any]] | None = None, title: str | None = None, show_sources: bool = True, conductivity_type: str = 'scalar')
Bases: BaseReportlet
Reportlet for displaying tissue conductivity values.
Shows conductivity values for different tissue types with their sources/references.
Initialize the conductivity table reportlet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
conductivities
|
dict[str, dict[str, Any]] | None
|
Dict mapping tissue names to conductivity info |
None
|
title
|
str | None
|
Title for the table |
None
|
show_sources
|
bool
|
Whether to show source references |
True
|
conductivity_type
|
str
|
Type of conductivity (scalar, anisotropic, etc.) |
'scalar'
|
Source code in tit/reporting/reportlets/metadata.py
set_conductivity ¶
Set conductivity for a tissue type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tissue
|
str
|
Tissue name |
required |
value
|
float
|
Conductivity value |
required |
unit
|
str
|
Unit of measurement |
'S/m'
|
source
|
str | None
|
Source reference |
None
|
Source code in tit/reporting/reportlets/metadata.py
render_html ¶
render_html() -> str
Render the conductivity table as HTML.
Source code in tit/reporting/reportlets/metadata.py
ProcessingStepReportlet ¶
Bases: BaseReportlet
Reportlet for displaying processing pipeline steps.
Shows collapsible processing steps with status, duration, and optional details.
Initialize the processing step reportlet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str | None
|
Title for the processing steps section |
None
|
steps
|
list[dict[str, Any]] | None
|
List of step dictionaries |
None
|
Source code in tit/reporting/reportlets/metadata.py
add_step ¶
add_step(name: str, description: str | None = None, status: StatusType | str = PENDING, duration: float | None = None, parameters: dict[str, Any] | None = None, output_files: list[str] | None = None, error_message: str | None = None) -> None
Add a processing step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Step name |
required |
description
|
str | None
|
Step description |
None
|
status
|
StatusType | str
|
Step status (pending, running, completed, failed, skipped) |
PENDING
|
duration
|
float | None
|
Duration in seconds |
None
|
parameters
|
dict[str, Any] | None
|
Step parameters |
None
|
output_files
|
list[str] | None
|
List of output file paths |
None
|
error_message
|
str | None
|
Error message if failed |
None
|
Source code in tit/reporting/reportlets/metadata.py
render_html ¶
render_html() -> str
Render the processing steps as HTML.
Source code in tit/reporting/reportlets/metadata.py
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 | |
SummaryCardsReportlet ¶
SummaryCardsReportlet(title: str | None = None, cards: list[dict[str, Any]] | None = None, columns: int = 4)
Bases: BaseReportlet
Reportlet for displaying key summary metrics as cards.
Shows important values in a prominent card grid layout.
Initialize the summary cards reportlet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str | None
|
Title for the summary section |
None
|
cards
|
list[dict[str, Any]] | None
|
List of card data dicts |
None
|
columns
|
int
|
Number of columns in grid |
4
|
Source code in tit/reporting/reportlets/metadata.py
add_card ¶
add_card(label: str, value: Any, icon: str | None = None, color: str | None = None, subtitle: str | None = None) -> None
Add a summary card.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
Card label |
required |
value
|
Any
|
Card value |
required |
icon
|
str | None
|
Optional icon character |
None
|
color
|
str | None
|
Optional accent color |
None
|
subtitle
|
str | None
|
Optional subtitle text |
None
|
Source code in tit/reporting/reportlets/metadata.py
render_html ¶
render_html() -> str
Render the summary cards as HTML.
Source code in tit/reporting/reportlets/metadata.py
ParameterListReportlet ¶
ParameterListReportlet(title: str | None = None, parameters: dict[str, dict[str, Any]] | None = None)
Bases: BaseReportlet
Reportlet for displaying a categorized list of parameters.
Organizes parameters into groups with clear visual hierarchy.
Initialize the parameter list reportlet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str | None
|
Title for the parameters section |
None
|
parameters
|
dict[str, dict[str, Any]] | None
|
Dict of category -> {param_name: param_value} |
None
|
Source code in tit/reporting/reportlets/metadata.py
add_category ¶
add_parameter ¶
render_html ¶
render_html() -> str
Render the parameter list as HTML.
Source code in tit/reporting/reportlets/metadata.py
MethodsBoilerplateReportlet ¶
MethodsBoilerplateReportlet(title: str | None = None, boilerplate_text: str | None = None, pipeline_type: str = 'simulation', parameters: dict[str, Any] | None = None)
Bases: BaseReportlet
Reportlet for displaying methods section boilerplate text.
Generates publication-ready text describing the methods used in the analysis, with a copy-to-clipboard button.
Initialize the methods boilerplate reportlet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str | None
|
Title for the section |
None
|
boilerplate_text
|
str | None
|
Pre-written boilerplate text |
None
|
pipeline_type
|
str
|
Type of pipeline (simulation, preprocessing, optimization) |
'simulation'
|
parameters
|
dict[str, Any] | None
|
Parameters to include in generated text |
None
|
Source code in tit/reporting/reportlets/text.py
generate_boilerplate ¶
generate_boilerplate() -> str
Generate boilerplate text based on pipeline type and parameters.
Returns:
| Type | Description |
|---|---|
str
|
Generated boilerplate text |
Source code in tit/reporting/reportlets/text.py
render_html ¶
render_html() -> str
Render the boilerplate text as HTML.
Source code in tit/reporting/reportlets/text.py
DescriptionReportlet ¶
Bases: BaseReportlet
Reportlet for displaying descriptive text content.
Renders paragraphs of text with optional formatting.
Initialize the description reportlet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
content
|
str
|
Text content to display |
required |
title
|
str | None
|
Optional section title |
None
|
format_type
|
str
|
How to format content (paragraphs, html, preformatted) |
'paragraphs'
|
Source code in tit/reporting/reportlets/text.py
render_html ¶
render_html() -> str
Render the description text as HTML.
Source code in tit/reporting/reportlets/text.py
CommandLogReportlet ¶
Bases: BaseReportlet
Reportlet for displaying command execution logs.
Shows commands that were run with their outputs in a terminal-like display.
Initialize the command log reportlet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str | None
|
Optional section title |
None
|
commands
|
list[dict[str, str]] | None
|
List of command dicts with 'command' and optional 'output' |
None
|
Source code in tit/reporting/reportlets/text.py
add_command ¶
Add a command to the log.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
command
|
str
|
The command that was executed |
required |
output
|
str | None
|
Command output (if any) |
None
|
status
|
str
|
Execution status (success, error) |
'success'
|
Source code in tit/reporting/reportlets/text.py
render_html ¶
render_html() -> str
Render the command log as HTML.
Source code in tit/reporting/reportlets/text.py
TIToolboxReferencesReportlet ¶
TIToolboxReferencesReportlet(title: str | None = None, include_defaults: bool = True, pipeline_components: list[str] | None = None)
Bases: ReferencesReportlet
Specialized references reportlet with TI-Toolbox default citations.
Automatically includes relevant citations based on the pipeline components used.
Initialize the TI-Toolbox references reportlet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str | None
|
Section title |
None
|
include_defaults
|
bool
|
Whether to include default TI-Toolbox refs |
True
|
pipeline_components
|
list[str] | None
|
List of components used (to filter refs) |
None
|
Source code in tit/reporting/reportlets/references.py
add_default_reference ¶
Add a default reference by key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
The reference key (e.g., 'freesurfer', 'qsiprep') |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if reference was found and added, False otherwise |