Skip to content

references

tit.reporting.reportlets.references

References reportlet for TI-Toolbox reports.

This module provides the default citations and references used across TI-Toolbox reports.

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
def __init__(
    self,
    title: str | None = None,
    include_defaults: bool = True,
    pipeline_components: list[str] | None = None,
):
    """
    Initialize the TI-Toolbox references reportlet.

    Args:
        title: Section title
        include_defaults: Whether to include default TI-Toolbox refs
        pipeline_components: List of components used (to filter refs)
    """
    super().__init__(title=title or "References")

    self.pipeline_components = pipeline_components or []

    if include_defaults:
        self._add_default_references()

add_default_reference

add_default_reference(key: str) -> bool

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

Source code in tit/reporting/reportlets/references.py
def add_default_reference(self, key: str) -> bool:
    """
    Add a default reference by key.

    Args:
        key: The reference key (e.g., 'freesurfer', 'qsiprep')

    Returns:
        True if reference was found and added, False otherwise
    """
    for ref_data in DEFAULT_REFERENCES:
        if ref_data["key"] == key:
            # Check if already added
            if not any(r["key"] == key for r in self.references):
                self.add_reference(
                    key=ref_data["key"],
                    citation=ref_data["citation"],
                    doi=ref_data.get("doi"),
                    url=ref_data.get("url"),
                )
            return True
    return False

get_default_references

get_default_references() -> list[dict[str, str]]

Get the list of default TI-Toolbox references.

Returns:

Type Description
list[dict[str, str]]

List of reference dictionaries

Source code in tit/reporting/reportlets/references.py
def get_default_references() -> list[dict[str, str]]:
    """
    Get the list of default TI-Toolbox references.

    Returns:
        List of reference dictionaries
    """
    return DEFAULT_REFERENCES.copy()

get_reference_by_key

get_reference_by_key(key: str) -> dict[str, str] | None

Get a specific reference by its key.

Parameters:

Name Type Description Default
key str

The reference key

required

Returns:

Type Description
dict[str, str] | None

Reference dictionary or None if not found

Source code in tit/reporting/reportlets/references.py
def get_reference_by_key(key: str) -> dict[str, str] | None:
    """
    Get a specific reference by its key.

    Args:
        key: The reference key

    Returns:
        Reference dictionary or None if not found
    """
    for ref in DEFAULT_REFERENCES:
        if ref["key"] == key:
            return ref.copy()
    return None