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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRIS_FIND_FLAT_REGIONS_METADATA = Metadata(
    id="5c7cb3d5470380e27f2e79106dbfa81d9cc3d3a9.boutiques",
    name="mris_find_flat_regions",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class MrisFindFlatRegionsOutputs(typing.NamedTuple):
    """
    Output object returned when calling `mris_find_flat_regions(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_label_file: OutputPathType
    """Output label file with regions where the surface is almost perpendicular
    to one of the cardinal axes"""


def mris_find_flat_regions(
    surface: InputPathType,
    wfile: str,
    threshold: float | None = 0.99,
    runner: Runner | None = None,
) -> MrisFindFlatRegionsOutputs:
    """
    Compute regions in which the surface is almost perpendicular to one of the
    cardinal axes and write the results to a label file.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        surface: Surface input file.
        wfile: Output label file.
        threshold: Threshold to use (default=0.990).
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MrisFindFlatRegionsOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRIS_FIND_FLAT_REGIONS_METADATA)
    cargs = []
    cargs.append("mris_find_flat_regions")
    cargs.append(execution.input_file(surface))
    cargs.append(wfile)
    if threshold is not None:
        cargs.extend([
            "-t",
            str(threshold)
        ])
    ret = MrisFindFlatRegionsOutputs(
        root=execution.output_file("."),
        output_label_file=execution.output_file(wfile),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRIS_FIND_FLAT_REGIONS_METADATA",
    "MrisFindFlatRegionsOutputs",
    "mris_find_flat_regions",
]
