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

import typing
import pathlib
from styxdefs import *

SURFACE_WEDGE_VOLUME_METADATA = Metadata(
    id="e5f6617fc469136137d2ad521599b19078079c17.boutiques",
    name="surface-wedge-volume",
    package="workbench",
    container_image_tag="brainlife/connectome_workbench:1.5.0-freesurfer-update",
)


SurfaceWedgeVolumeParameters = typing.TypedDict('SurfaceWedgeVolumeParameters', {
    "@type": typing.NotRequired[typing.Literal["workbench/surface-wedge-volume"]],
    "inner_surface": InputPathType,
    "outer_surface": InputPathType,
    "metric": str,
})
SurfaceWedgeVolumeParametersTagged = typing.TypedDict('SurfaceWedgeVolumeParametersTagged', {
    "@type": typing.Literal["workbench/surface-wedge-volume"],
    "inner_surface": InputPathType,
    "outer_surface": InputPathType,
    "metric": str,
})


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


def surface_wedge_volume_params(
    inner_surface: InputPathType,
    outer_surface: InputPathType,
    metric: str,
) -> SurfaceWedgeVolumeParametersTagged:
    """
    Build parameters.
    
    Args:
        inner_surface: the inner surface.
        outer_surface: the outer surface.
        metric: the output metric.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "workbench/surface-wedge-volume",
        "inner_surface": inner_surface,
        "outer_surface": outer_surface,
        "metric": metric,
    }
    return params


def surface_wedge_volume_cargs(
    params: SurfaceWedgeVolumeParameters,
    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-wedge-volume")
    cargs.append(execution.input_file(params.get("inner_surface", None)))
    cargs.append(execution.input_file(params.get("outer_surface", None)))
    cargs.append(params.get("metric", None))
    return cargs


def surface_wedge_volume_outputs(
    params: SurfaceWedgeVolumeParameters,
    execution: Execution,
) -> SurfaceWedgeVolumeOutputs:
    """
    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 = SurfaceWedgeVolumeOutputs(
        root=execution.output_file("."),
        metric=execution.output_file(params.get("metric", None)),
    )
    return ret


def surface_wedge_volume_execute(
    params: SurfaceWedgeVolumeParameters,
    runner: Runner | None = None,
) -> SurfaceWedgeVolumeOutputs:
    """
    surface-wedge-volume
    
    Measure per-vertex volume between surfaces.
    
    Compute the volume of each vertex's area from one surface to another. The
    surfaces must have vertex correspondence, and have consistent triangle
    orientation.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        params: The parameters.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `SurfaceWedgeVolumeOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(SURFACE_WEDGE_VOLUME_METADATA)
    params = execution.params(params)
    cargs = surface_wedge_volume_cargs(params, execution)
    ret = surface_wedge_volume_outputs(params, execution)
    execution.run(cargs)
    return ret


def surface_wedge_volume(
    inner_surface: InputPathType,
    outer_surface: InputPathType,
    metric: str,
    runner: Runner | None = None,
) -> SurfaceWedgeVolumeOutputs:
    """
    surface-wedge-volume
    
    Measure per-vertex volume between surfaces.
    
    Compute the volume of each vertex's area from one surface to another. The
    surfaces must have vertex correspondence, and have consistent triangle
    orientation.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        inner_surface: the inner surface.
        outer_surface: the outer surface.
        metric: the output metric.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `SurfaceWedgeVolumeOutputs`).
    """
    params = surface_wedge_volume_params(
        inner_surface=inner_surface,
        outer_surface=outer_surface,
        metric=metric,
    )
    return surface_wedge_volume_execute(params, runner)


__all__ = [
    "SURFACE_WEDGE_VOLUME_METADATA",
    "SurfaceWedgeVolumeOutputs",
    "surface_wedge_volume",
    "surface_wedge_volume_execute",
    "surface_wedge_volume_params",
]
