# This file was auto generated by Styx.
# Do not edit this file directly.

import typing
import pathlib
from styxdefs import *
import dataclasses

TALAIRACH_METADATA = Metadata(
    id="1512333dd2617cccb8f9ea33a7bc7b56b8c724e3.boutiques",
    name="talairach",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class TalairachOutputs(typing.NamedTuple):
    """
    Output object returned when calling `talairach(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    xfm_output: OutputPathType
    """Output transformation file."""


def talairach(
    input_volume: InputPathType,
    output_transform: str,
    log_flag: bool = False,
    debug_flag: bool = False,
    runner: Runner | None = None,
) -> TalairachOutputs:
    """
    Front-end for MINC's mritotal to compute the Talairach transform mapping the
    input volume to the MNI305.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        input_volume: Input volume.
        output_transform: Output transform file (xfm).
        log_flag: Specify log file. Default is outdir/talarach.log.
        debug_flag: Turn on debugging.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `TalairachOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(TALAIRACH_METADATA)
    cargs = []
    cargs.append("mri_nu_correct.mni")
    cargs.extend([
        "-i",
        "-" + execution.input_file(input_volume)
    ])
    cargs.extend([
        "-xfm",
        "-" + output_transform
    ])
    if log_flag:
        cargs.append("--log")
    if debug_flag:
        cargs.append("--debug")
    ret = TalairachOutputs(
        root=execution.output_file("."),
        xfm_output=execution.output_file(output_transform),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "TALAIRACH_METADATA",
    "TalairachOutputs",
    "talairach",
]
