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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRIS_MESH_SUBDIVIDE_METADATA = Metadata(
    id="fb137b14730056953d8eae8a55716f7ac7551282.boutiques",
    name="mris_mesh_subdivide",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class MrisMeshSubdivideOutputs(typing.NamedTuple):
    """
    Output object returned when calling `mris_mesh_subdivide(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    subdivided_surface: OutputPathType
    """The subdivided mesh surface output file"""


def mris_mesh_subdivide(
    input_surface: InputPathType,
    output_surface: str,
    subdivision_method: typing.Literal["butterfly", "loop", "linear"] | None = None,
    iterations: float | None = None,
    runner: Runner | None = None,
) -> MrisMeshSubdivideOutputs:
    """
    This program will subdivide a triangular mesh surface.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        input_surface: Name of input surface file.
        output_surface: Name for output surface file (outputs to same directory\
            as input if path not provided).
        subdivision_method: Subdivision method: options are 'butterfly'\
            (default), 'loop', or 'linear'.
        iterations: Number of subdivision iterations.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MrisMeshSubdivideOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRIS_MESH_SUBDIVIDE_METADATA)
    cargs = []
    cargs.append("mris_mesh_subdivide")
    cargs.extend([
        "--surf",
        execution.input_file(input_surface)
    ])
    cargs.extend([
        "--out",
        output_surface
    ])
    if subdivision_method is not None:
        cargs.extend([
            "--method",
            subdivision_method
        ])
    if iterations is not None:
        cargs.extend([
            "--iter",
            str(iterations)
        ])
    ret = MrisMeshSubdivideOutputs(
        root=execution.output_file("."),
        subdivided_surface=execution.output_file(output_surface),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRIS_MESH_SUBDIVIDE_METADATA",
    "MrisMeshSubdivideOutputs",
    "mris_mesh_subdivide",
]
