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

import typing
import pathlib
from styxdefs import *

SURFACE_SET_COORDINATES_METADATA = Metadata(
    id="72e93a016bdeefa39870b1c99e99dc40793bcdc3.boutiques",
    name="surface-set-coordinates",
    package="workbench",
    container_image_tag="brainlife/connectome_workbench:1.5.0-freesurfer-update",
)


SurfaceSetCoordinatesParameters = typing.TypedDict('SurfaceSetCoordinatesParameters', {
    "@type": typing.NotRequired[typing.Literal["workbench/surface-set-coordinates"]],
    "surface_in": InputPathType,
    "coord_metric": InputPathType,
    "surface_out": str,
})
SurfaceSetCoordinatesParametersTagged = typing.TypedDict('SurfaceSetCoordinatesParametersTagged', {
    "@type": typing.Literal["workbench/surface-set-coordinates"],
    "surface_in": InputPathType,
    "coord_metric": InputPathType,
    "surface_out": str,
})


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


def surface_set_coordinates_params(
    surface_in: InputPathType,
    coord_metric: InputPathType,
    surface_out: str,
) -> SurfaceSetCoordinatesParametersTagged:
    """
    Build parameters.
    
    Args:
        surface_in: the surface to use for the topology.
        coord_metric: the new coordinates, as a 3-column metric file.
        surface_out: the new surface.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "workbench/surface-set-coordinates",
        "surface_in": surface_in,
        "coord_metric": coord_metric,
        "surface_out": surface_out,
    }
    return params


def surface_set_coordinates_cargs(
    params: SurfaceSetCoordinatesParameters,
    execution: Execution,
) -> list[str]:
    """
    Build command-line arguments from parameters.
    
    Args:
        params: The parameters.
        execution: The execution object for resolving input paths.
    Returns:
        Command-line arguments.
    """
    cargs = []
    cargs.append("wb_command")
    cargs.append("-surface-set-coordinates")
    cargs.append(execution.input_file(params.get("surface_in", None)))
    cargs.append(execution.input_file(params.get("coord_metric", None)))
    cargs.append(params.get("surface_out", None))
    return cargs


def surface_set_coordinates_outputs(
    params: SurfaceSetCoordinatesParameters,
    execution: Execution,
) -> SurfaceSetCoordinatesOutputs:
    """
    Build outputs object containing output file paths and possibly stdout/stderr.
    
    Args:
        params: The parameters.
        execution: The execution object for resolving input paths.
    Returns:
        Outputs object.
    """
    ret = SurfaceSetCoordinatesOutputs(
        root=execution.output_file("."),
        surface_out=execution.output_file(params.get("surface_out", None)),
    )
    return ret


def surface_set_coordinates_execute(
    params: SurfaceSetCoordinatesParameters,
    runner: Runner | None = None,
) -> SurfaceSetCoordinatesOutputs:
    """
    surface-set-coordinates
    
    Modify coordinates of a surface.
    
    Takes the topology from an existing surface file, and uses values from a
    metric file as coordinates to construct a new surface file.
    
    See -surface-coordinates-to-metric for how to get surface coordinates as a
    metric file, such that you can then modify them via metric commands, etc.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        params: The parameters.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `SurfaceSetCoordinatesOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(SURFACE_SET_COORDINATES_METADATA)
    params = execution.params(params)
    cargs = surface_set_coordinates_cargs(params, execution)
    ret = surface_set_coordinates_outputs(params, execution)
    execution.run(cargs)
    return ret


def surface_set_coordinates(
    surface_in: InputPathType,
    coord_metric: InputPathType,
    surface_out: str,
    runner: Runner | None = None,
) -> SurfaceSetCoordinatesOutputs:
    """
    surface-set-coordinates
    
    Modify coordinates of a surface.
    
    Takes the topology from an existing surface file, and uses values from a
    metric file as coordinates to construct a new surface file.
    
    See -surface-coordinates-to-metric for how to get surface coordinates as a
    metric file, such that you can then modify them via metric commands, etc.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        surface_in: the surface to use for the topology.
        coord_metric: the new coordinates, as a 3-column metric file.
        surface_out: the new surface.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `SurfaceSetCoordinatesOutputs`).
    """
    params = surface_set_coordinates_params(
        surface_in=surface_in,
        coord_metric=coord_metric,
        surface_out=surface_out,
    )
    return surface_set_coordinates_execute(params, runner)


__all__ = [
    "SURFACE_SET_COORDINATES_METADATA",
    "SurfaceSetCoordinatesOutputs",
    "surface_set_coordinates",
    "surface_set_coordinates_execute",
    "surface_set_coordinates_params",
]
