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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRI_CREATE_T2COMBINED_METADATA = Metadata(
    id="629ff11abf5f1e027b0ae35e81e63322a5505789.boutiques",
    name="mri_create_t2combined",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class MriCreateT2combinedOutputs(typing.NamedTuple):
    """
    Output object returned when calling `mri_create_t2combined(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    logfile: OutputPathType
    """Log file generated by the command"""
    t2combined_output: OutputPathType
    """The T2* 7T combined partial-brain halves output file"""


def mri_create_t2combined(
    subjid: str,
    t1wb: InputPathType,
    t2upper: InputPathType,
    t2lower: InputPathType,
    t2combined: str,
    t2middle: InputPathType | None = None,
    show: bool = False,
    runner: Runner | None = None,
) -> MriCreateT2combinedOutputs:
    """
    Utility to combine two or three T2* 7T partial-brain volumes into one volume,
    retaining resolution and registered to the MPRAGE anatomical.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        subjid: Subject ID of the FreeSurfer anatomical.
        t1wb: T1 7T whole-brain image.
        t2upper: T2* 7T partial-brain upper half image.
        t2lower: T2* 7T partial-brain lower half image.
        t2combined: Output file for T2* 7T combined partial-brain halves.
        t2middle: T2* 7T partial-brain middle half image, or enter 'none'.
        show: If the last argument is 'show', then the commands that will run\
            are shown but not executed.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MriCreateT2combinedOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRI_CREATE_T2COMBINED_METADATA)
    cargs = []
    cargs.append("mri_create_t2combined")
    cargs.append(subjid)
    cargs.append(execution.input_file(t1wb))
    cargs.append(execution.input_file(t2upper))
    if t2middle is not None:
        cargs.append(execution.input_file(t2middle))
    cargs.append(execution.input_file(t2lower))
    cargs.append(t2combined)
    if show:
        cargs.append("show")
    ret = MriCreateT2combinedOutputs(
        root=execution.output_file("."),
        logfile=execution.output_file("/root/mri_create_t2combined.log"),
        t2combined_output=execution.output_file(t2combined),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRI_CREATE_T2COMBINED_METADATA",
    "MriCreateT2combinedOutputs",
    "mri_create_t2combined",
]
