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

import typing
import pathlib
from styxdefs import *
import dataclasses

SETLABELSTAT_METADATA = Metadata(
    id="4886639a09879a1b6f761d93393746968357bada.boutiques",
    name="setlabelstat",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class SetlabelstatOutputs(typing.NamedTuple):
    """
    Output object returned when calling `setlabelstat(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_label_file: OutputPathType
    """The resulting label file with updated stat values."""


def setlabelstat(
    inlabelfile: InputPathType,
    outlabelfile: InputPathType,
    statval: float,
    help_: bool = False,
    runner: Runner | None = None,
) -> SetlabelstatOutputs:
    """
    Replaces the stat values in a label file with the single stat value supplied on
    the command-line.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        inlabelfile: Input label file.
        outlabelfile: Output label file.
        statval: Stat value to replace in the label file.
        help_: Displays help information.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `SetlabelstatOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(SETLABELSTAT_METADATA)
    cargs = []
    cargs.append("setlabelstat")
    cargs.extend([
        "-i",
        execution.input_file(inlabelfile)
    ])
    cargs.extend([
        "-o",
        execution.input_file(outlabelfile)
    ])
    cargs.extend([
        "-s",
        str(statval)
    ])
    if help_:
        cargs.append("-help")
    ret = SetlabelstatOutputs(
        root=execution.output_file("."),
        output_label_file=execution.output_file(pathlib.Path(outlabelfile).name),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "SETLABELSTAT_METADATA",
    "SetlabelstatOutputs",
    "setlabelstat",
]
