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

import typing
import pathlib
from styxdefs import *
import dataclasses

MAKE_UPRIGHT_METADATA = Metadata(
    id="522244f0d58e1f0d0f3872b5729dcc10bc9de41f.boutiques",
    name="make_upright",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class MakeUprightOutputs(typing.NamedTuple):
    """
    Output object returned when calling `make_upright(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    registered_image: OutputPathType
    """Registered upright MRI image"""


def make_upright(
    input_image: InputPathType,
    output_image: InputPathType,
    transformation_map: InputPathType,
    runner: Runner | None = None,
) -> MakeUprightOutputs:
    """
    Registers MRI input to the left/right reversed version using mri_robust_register
    and making use of the half-way space, resulting in an upright, forward facing
    head position.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        input_image: Input MRI image file in .mgz format.
        output_image: Output MRI image file in .mgz format.
        transformation_map: Transformation map file in .lta format.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MakeUprightOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MAKE_UPRIGHT_METADATA)
    cargs = []
    cargs.append("make_upright")
    cargs.append(execution.input_file(input_image))
    cargs.append(execution.input_file(output_image))
    cargs.append(execution.input_file(transformation_map))
    ret = MakeUprightOutputs(
        root=execution.output_file("."),
        registered_image=execution.output_file(pathlib.Path(output_image).name),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MAKE_UPRIGHT_METADATA",
    "MakeUprightOutputs",
    "make_upright",
]
