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

import typing
import pathlib
from styxdefs import *

SURFACE_COORDINATES_TO_METRIC_METADATA = Metadata(
    id="5cba1432e52e6cde1dfbf6613fe3e4f9bb95feee.boutiques",
    name="surface-coordinates-to-metric",
    package="workbench",
    container_image_tag="brainlife/connectome_workbench:1.5.0-freesurfer-update",
)


SurfaceCoordinatesToMetricParameters = typing.TypedDict('SurfaceCoordinatesToMetricParameters', {
    "@type": typing.NotRequired[typing.Literal["workbench/surface-coordinates-to-metric"]],
    "surface": InputPathType,
    "metric_out": str,
})
SurfaceCoordinatesToMetricParametersTagged = typing.TypedDict('SurfaceCoordinatesToMetricParametersTagged', {
    "@type": typing.Literal["workbench/surface-coordinates-to-metric"],
    "surface": InputPathType,
    "metric_out": str,
})


class SurfaceCoordinatesToMetricOutputs(typing.NamedTuple):
    """
    Output object returned when calling `SurfaceCoordinatesToMetricParameters(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    metric_out: OutputPathType
    """the output metric"""


def surface_coordinates_to_metric_params(
    surface: InputPathType,
    metric_out: str,
) -> SurfaceCoordinatesToMetricParametersTagged:
    """
    Build parameters.
    
    Args:
        surface: the surface to use the coordinates of.
        metric_out: the output metric.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "workbench/surface-coordinates-to-metric",
        "surface": surface,
        "metric_out": metric_out,
    }
    return params


def surface_coordinates_to_metric_cargs(
    params: SurfaceCoordinatesToMetricParameters,
    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-coordinates-to-metric")
    cargs.append(execution.input_file(params.get("surface", None)))
    cargs.append(params.get("metric_out", None))
    return cargs


def surface_coordinates_to_metric_outputs(
    params: SurfaceCoordinatesToMetricParameters,
    execution: Execution,
) -> SurfaceCoordinatesToMetricOutputs:
    """
    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 = SurfaceCoordinatesToMetricOutputs(
        root=execution.output_file("."),
        metric_out=execution.output_file(params.get("metric_out", None)),
    )
    return ret


def surface_coordinates_to_metric_execute(
    params: SurfaceCoordinatesToMetricParameters,
    runner: Runner | None = None,
) -> SurfaceCoordinatesToMetricOutputs:
    """
    surface-coordinates-to-metric
    
    Make metric file of surface coordinates.
    
    Puts the coordinates of the surface into a 3-map metric file, as x, y, z.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        params: The parameters.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `SurfaceCoordinatesToMetricOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(SURFACE_COORDINATES_TO_METRIC_METADATA)
    params = execution.params(params)
    cargs = surface_coordinates_to_metric_cargs(params, execution)
    ret = surface_coordinates_to_metric_outputs(params, execution)
    execution.run(cargs)
    return ret


def surface_coordinates_to_metric(
    surface: InputPathType,
    metric_out: str,
    runner: Runner | None = None,
) -> SurfaceCoordinatesToMetricOutputs:
    """
    surface-coordinates-to-metric
    
    Make metric file of surface coordinates.
    
    Puts the coordinates of the surface into a 3-map metric file, as x, y, z.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        surface: the surface to use the coordinates of.
        metric_out: the output metric.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `SurfaceCoordinatesToMetricOutputs`).
    """
    params = surface_coordinates_to_metric_params(
        surface=surface,
        metric_out=metric_out,
    )
    return surface_coordinates_to_metric_execute(params, runner)


__all__ = [
    "SURFACE_COORDINATES_TO_METRIC_METADATA",
    "SurfaceCoordinatesToMetricOutputs",
    "surface_coordinates_to_metric",
    "surface_coordinates_to_metric_execute",
    "surface_coordinates_to_metric_params",
]
