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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRIS_DISTANCE_TRANSFORM_METADATA = Metadata(
    id="26094bdcfe452c9a39b8df3e9a0e8773e3b9085f.boutiques",
    name="mris_distance_transform",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class MrisDistanceTransformOutputs(typing.NamedTuple):
    """
    Output object returned when calling `mris_distance_transform(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    result_file: OutputPathType
    """Resulting file after applying the distance transform."""


def mris_distance_transform(
    surface: InputPathType,
    label: InputPathType,
    mode: typing.Literal["signed", "unsigned", "outside"],
    output_file: str,
    anterior: float | None = None,
    posterior: float | None = None,
    divide: float | None = None,
    olabel: bool = False,
    runner: Runner | None = None,
) -> MrisDistanceTransformOutputs:
    """
    Computes the distance transform of a label on the surface.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        surface: Surface file for processing.
        label: Label file to apply distance transform.
        mode: Mode of the distance transform, can be 'signed', 'unsigned', or\
            'outside'.
        output_file: Output file for the distance transform results.
        anterior: Only use anteriormost <dist> portion of the label.
        posterior: Only use posteriormost <dist> portion of the label.
        divide: Divide label into <n> units along primary eigendirection.
        olabel: Output label subdivisions.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MrisDistanceTransformOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRIS_DISTANCE_TRANSFORM_METADATA)
    cargs = []
    cargs.append("mris_distance_transform")
    cargs.append(execution.input_file(surface))
    cargs.append(execution.input_file(label))
    cargs.append(mode)
    cargs.append(output_file)
    if anterior is not None:
        cargs.extend([
            "-anterior",
            str(anterior)
        ])
    if posterior is not None:
        cargs.extend([
            "-posterior",
            str(posterior)
        ])
    if divide is not None:
        cargs.extend([
            "-divide",
            str(divide)
        ])
    if olabel:
        cargs.append("-olabel")
    ret = MrisDistanceTransformOutputs(
        root=execution.output_file("."),
        result_file=execution.output_file(output_file),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRIS_DISTANCE_TRANSFORM_METADATA",
    "MrisDistanceTransformOutputs",
    "mris_distance_transform",
]
