Skip to content

dti_qc

tit.reporting.generators.dti_qc

DTI quality control report generator for TI-Toolbox.

Produces an HTML report with FA-on-T1 registration overlays, color-coded principal diffusion direction maps, and tensor statistics.

DTIQCReportGenerator

DTIQCReportGenerator(project_dir: str | Path, subject_id: str)

Bases: BaseReportGenerator

Report generator for DTI tensor quality control.

Source code in tit/reporting/generators/dti_qc.py
def __init__(
    self,
    project_dir: str | Path,
    subject_id: str,
):
    super().__init__(
        project_dir=project_dir,
        subject_id=subject_id,
        report_type="dti_qc",
    )
    self._tensor_file: str = ""
    self._t1_file: str = ""
    self._metrics: dict = {}
    self._color_fa_images: dict = {}
    self._fa_overlay_images: dict = {}

generate

generate(tensor_file: str, t1_file: str) -> Path

Generate the DTI QC report.

Parameters

tensor_file : str Path to the 6-component tensor NIfTI. t1_file : str Path to the T1-weighted anatomical NIfTI.

Returns

Path Path to the saved HTML report.

Source code in tit/reporting/generators/dti_qc.py
def generate(self, tensor_file: str, t1_file: str) -> Path:
    """Generate the DTI QC report.

    Parameters
    ----------
    tensor_file : str
        Path to the 6-component tensor NIfTI.
    t1_file : str
        Path to the T1-weighted anatomical NIfTI.

    Returns
    -------
    Path
        Path to the saved HTML report.
    """
    from tit.plotting.dti_qc import compute_dti_qc_metrics, generate_color_fa_image
    from tit.plotting.static_overlay import generate_static_overlay_images

    self._tensor_file = tensor_file
    self._t1_file = t1_file

    # 1. Compute metrics
    self._metrics = compute_dti_qc_metrics(tensor_file)

    # 2. Generate color FA images
    self._color_fa_images = generate_color_fa_image(tensor_file, t1_file)

    # 3. Compute FA volume and generate FA-on-T1 overlay
    self._fa_overlay_images = self._generate_fa_overlay(tensor_file, t1_file)

    # 4. Build and save report (calls _build_report via super)
    return super().generate()

create_dti_qc_report

create_dti_qc_report(project_dir: str | Path, subject_id: str, tensor_file: str, t1_file: str) -> Path

Convenience wrapper to generate a DTI QC report.

Parameters

project_dir : str or Path BIDS project root. subject_id : str Subject identifier (without sub- prefix). tensor_file : str Path to the 6-component tensor NIfTI. t1_file : str Path to the T1-weighted NIfTI.

Returns

Path Path to the saved HTML report.

Source code in tit/reporting/generators/dti_qc.py
def create_dti_qc_report(
    project_dir: str | Path,
    subject_id: str,
    tensor_file: str,
    t1_file: str,
) -> Path:
    """Convenience wrapper to generate a DTI QC report.

    Parameters
    ----------
    project_dir : str or Path
        BIDS project root.
    subject_id : str
        Subject identifier (without ``sub-`` prefix).
    tensor_file : str
        Path to the 6-component tensor NIfTI.
    t1_file : str
        Path to the T1-weighted NIfTI.

    Returns
    -------
    Path
        Path to the saved HTML report.
    """
    gen = DTIQCReportGenerator(project_dir=project_dir, subject_id=subject_id)
    return gen.generate(tensor_file=tensor_file, t1_file=t1_file)