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

import typing
import pathlib
from styxdefs import *

FOCI_GET_PROJECTION_VERTEX_METADATA = Metadata(
    id="fa9f290a6c602982e012db429ea537b40f61be20.boutiques",
    name="foci-get-projection-vertex",
    package="workbench",
    container_image_tag="brainlife/connectome_workbench:1.5.0-freesurfer-update",
)


FociGetProjectionVertexParameters = typing.TypedDict('FociGetProjectionVertexParameters', {
    "@type": typing.NotRequired[typing.Literal["workbench/foci-get-projection-vertex"]],
    "foci": InputPathType,
    "surface": InputPathType,
    "metric_out": str,
    "opt_name_name": typing.NotRequired[str | None],
})
FociGetProjectionVertexParametersTagged = typing.TypedDict('FociGetProjectionVertexParametersTagged', {
    "@type": typing.Literal["workbench/foci-get-projection-vertex"],
    "foci": InputPathType,
    "surface": InputPathType,
    "metric_out": str,
    "opt_name_name": typing.NotRequired[str | None],
})


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


def foci_get_projection_vertex_params(
    foci: InputPathType,
    surface: InputPathType,
    metric_out: str,
    opt_name_name: str | None = None,
) -> FociGetProjectionVertexParametersTagged:
    """
    Build parameters.
    
    Args:
        foci: the foci file.
        surface: the surface related to the foci file.
        metric_out: the output metric file.
        opt_name_name: select a focus by name: the name of the focus.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "workbench/foci-get-projection-vertex",
        "foci": foci,
        "surface": surface,
        "metric_out": metric_out,
    }
    if opt_name_name is not None:
        params["opt_name_name"] = opt_name_name
    return params


def foci_get_projection_vertex_cargs(
    params: FociGetProjectionVertexParameters,
    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("-foci-get-projection-vertex")
    cargs.append(execution.input_file(params.get("foci", None)))
    cargs.append(execution.input_file(params.get("surface", None)))
    cargs.append(params.get("metric_out", None))
    if params.get("opt_name_name", None) is not None:
        cargs.extend([
            "-name",
            params.get("opt_name_name", None)
        ])
    return cargs


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


def foci_get_projection_vertex_execute(
    params: FociGetProjectionVertexParameters,
    runner: Runner | None = None,
) -> FociGetProjectionVertexOutputs:
    """
    foci-get-projection-vertex
    
    Get projection vertex for foci.
    
    For each focus, a column is created in <metric-out>, and the vertex with the
    most influence on its projection is assigned a value of 1 in that column,
    with all other vertices 0. If -name is used, only one focus will be used.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        params: The parameters.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `FociGetProjectionVertexOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(FOCI_GET_PROJECTION_VERTEX_METADATA)
    params = execution.params(params)
    cargs = foci_get_projection_vertex_cargs(params, execution)
    ret = foci_get_projection_vertex_outputs(params, execution)
    execution.run(cargs)
    return ret


def foci_get_projection_vertex(
    foci: InputPathType,
    surface: InputPathType,
    metric_out: str,
    opt_name_name: str | None = None,
    runner: Runner | None = None,
) -> FociGetProjectionVertexOutputs:
    """
    foci-get-projection-vertex
    
    Get projection vertex for foci.
    
    For each focus, a column is created in <metric-out>, and the vertex with the
    most influence on its projection is assigned a value of 1 in that column,
    with all other vertices 0. If -name is used, only one focus will be used.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        foci: the foci file.
        surface: the surface related to the foci file.
        metric_out: the output metric file.
        opt_name_name: select a focus by name: the name of the focus.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `FociGetProjectionVertexOutputs`).
    """
    params = foci_get_projection_vertex_params(
        foci=foci,
        surface=surface,
        metric_out=metric_out,
        opt_name_name=opt_name_name,
    )
    return foci_get_projection_vertex_execute(params, runner)


__all__ = [
    "FOCI_GET_PROJECTION_VERTEX_METADATA",
    "FociGetProjectionVertexOutputs",
    "foci_get_projection_vertex",
    "foci_get_projection_vertex_execute",
    "foci_get_projection_vertex_params",
]
