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

import typing
import pathlib
from styxdefs import *
import dataclasses

BETSURF_METADATA = Metadata(
    id="8c8def8d6fc4d834cdaf615cbec87b9e20bcd394.boutiques",
    name="betsurf",
    package="fsl",
    container_image_tag="mcin/fsl:6.0.5",
)


class BetsurfOutputs(typing.NamedTuple):
    """
    Output object returned when calling `betsurf(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_mask: OutputPathType
    """Generated binary mask"""
    output_outline: OutputPathType
    """Generated surface outline"""
    output_skull: OutputPathType
    """Generated skull mask"""


def betsurf(
    runner: Runner | None = None,
) -> BetsurfOutputs:
    """
    BET Surface Finder to extract brain surfaces using T1 and T2 images.
    
    Author: FMRIB Analysis Group, Oxford
    
    URL: https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/BET
    
    Args:
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `BetsurfOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(BETSURF_METADATA)
    cargs = []
    cargs.append("betsurf")
    cargs.append("[OPTIONS]")
    cargs.append("<t1>")
    cargs.append("[<t2>]")
    cargs.append("<bet_mesh.vtk>")
    cargs.append("<t1_to_standard.mat>")
    cargs.append("<output>")
    ret = BetsurfOutputs(
        root=execution.output_file("."),
        output_mask=execution.output_file("[OUTPUT_PREFIX]_mask.nii.gz"),
        output_outline=execution.output_file("[OUTPUT_PREFIX]_outline.nii.gz"),
        output_skull=execution.output_file("[OUTPUT_PREFIX]_skull.nii.gz"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "BETSURF_METADATA",
    "BetsurfOutputs",
    "betsurf",
]
