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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRIS_SEGMENT_VALS_METADATA = Metadata(
    id="8fb7152be4e370cbcf1d314e781abb1f188e845e.boutiques",
    name="mris_segment_vals",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class MrisSegmentValsOutputs(typing.NamedTuple):
    """
    Output object returned when calling `mris_segment_vals(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_curv: OutputPathType
    """Output w/curv file after segmentation"""


def mris_segment_vals(
    input_surface: InputPathType,
    input_curv_file: InputPathType,
    output_curv_file: str,
    threshold: float | None = None,
    area_thresh: float | None = None,
    runner: Runner | None = None,
) -> MrisSegmentValsOutputs:
    """
    This program segments an input val file into connected components.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        input_surface: Input surface file.
        input_curv_file: Input w/curv file.
        output_curv_file: Output w/curv file.
        threshold: Threshold for segmentation (default is 0).
        area_thresh: Ignore segments smaller than <area thresh> mm (default 0).
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MrisSegmentValsOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRIS_SEGMENT_VALS_METADATA)
    cargs = []
    cargs.append("mris_segment_vals")
    cargs.append(execution.input_file(input_surface))
    cargs.append(execution.input_file(input_curv_file))
    cargs.append(output_curv_file)
    if threshold is not None:
        cargs.extend([
            "-T",
            str(threshold)
        ])
    if area_thresh is not None:
        cargs.extend([
            "-A",
            str(area_thresh)
        ])
    ret = MrisSegmentValsOutputs(
        root=execution.output_file("."),
        output_curv=execution.output_file(output_curv_file),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRIS_SEGMENT_VALS_METADATA",
    "MrisSegmentValsOutputs",
    "mris_segment_vals",
]
