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

import typing
import pathlib
from styxdefs import *
import dataclasses

SURFACE_FLIP_NORMALS_METADATA = Metadata(
    id="4435a2734d7103caa7988672c849cb2be5c821f0.boutiques",
    name="surface-flip-normals",
    package="workbench",
    container_image_tag="brainlife/connectome_workbench:1.5.0-freesurfer-update",
)


class SurfaceFlipNormalsOutputs(typing.NamedTuple):
    """
    Output object returned when calling `surface_flip_normals(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    surface_out: OutputPathType
    """the output surface"""


def surface_flip_normals(
    surface: InputPathType,
    surface_out: str,
    runner: Runner | None = None,
) -> SurfaceFlipNormalsOutputs:
    """
    Flip all tiles on a surface.
    
    Flips all triangles on a surface, resulting in surface normals being flipped
    the other direction (inward vs outward). If you transform a surface with an
    affine that has negative determinant, or a warpfield that similarly flips
    the surface, you may end up with a surface that has normals pointing
    inwards, which may have display problems. Using this command will solve that
    problem.
    
    Author: Washington University School of Medicin
    
    Args:
        surface: the surface to flip the normals of.
        surface_out: the output surface.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `SurfaceFlipNormalsOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(SURFACE_FLIP_NORMALS_METADATA)
    cargs = []
    cargs.append("wb_command")
    cargs.append("-surface-flip-normals")
    cargs.append(execution.input_file(surface))
    cargs.append(surface_out)
    ret = SurfaceFlipNormalsOutputs(
        root=execution.output_file("."),
        surface_out=execution.output_file(surface_out),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "SURFACE_FLIP_NORMALS_METADATA",
    "SurfaceFlipNormalsOutputs",
    "surface_flip_normals",
]
