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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRIS_EXPAND_METADATA = Metadata(
    id="b9cee6836960fc68a28400b950ad233fa015f146.boutiques",
    name="mris_expand",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class MrisExpandOutputs(typing.NamedTuple):
    """
    Output object returned when calling `mris_expand(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_surface_file: OutputPathType
    """Expanded output surface file"""


def mris_expand(
    input_surface: InputPathType,
    expansion_distance: float,
    output_surface: str,
    thickness: bool = False,
    label: str | None = None,
    tmap: str | None = None,
    tmap_random: str | None = None,
    runner: Runner | None = None,
) -> MrisExpandOutputs:
    """
    Expand a given surface by a specified distance.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        input_surface: Input surface file (e.g. lh.white).
        expansion_distance: Expansion distance in mm.
        output_surface: Output surface file.
        thickness: Use thickness for expansion.
        label: Use label file for expansion.
        tmap: Use a prespecified map of percent thickness to compute the target\
            locations for expansion.
        tmap_random: Create a random target distance map with Gaussian sampling\
            for the target locations.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MrisExpandOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRIS_EXPAND_METADATA)
    cargs = []
    cargs.append("mris_expand")
    cargs.append(execution.input_file(input_surface))
    cargs.append(str(expansion_distance))
    cargs.append(output_surface)
    if thickness:
        cargs.append("-thickness")
    if label is not None:
        cargs.extend([
            "-label",
            label
        ])
    if tmap is not None:
        cargs.extend([
            "-tmap",
            tmap
        ])
    if tmap_random is not None:
        cargs.extend([
            "-tmap random",
            tmap_random
        ])
    ret = MrisExpandOutputs(
        root=execution.output_file("."),
        output_surface_file=execution.output_file(output_surface),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRIS_EXPAND_METADATA",
    "MrisExpandOutputs",
    "mris_expand",
]
