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

import typing
import pathlib
from styxdefs import *

CIFTI_ALL_LABELS_TO_ROIS_METADATA = Metadata(
    id="6faa7bc1774fe5d690eab193fadb4498d97e0945.boutiques",
    name="cifti-all-labels-to-rois",
    package="workbench",
    container_image_tag="brainlife/connectome_workbench:1.5.0-freesurfer-update",
)


CiftiAllLabelsToRoisParameters = typing.TypedDict('CiftiAllLabelsToRoisParameters', {
    "@type": typing.NotRequired[typing.Literal["workbench/cifti-all-labels-to-rois"]],
    "label_in": InputPathType,
    "map": str,
    "cifti_out": str,
})
CiftiAllLabelsToRoisParametersTagged = typing.TypedDict('CiftiAllLabelsToRoisParametersTagged', {
    "@type": typing.Literal["workbench/cifti-all-labels-to-rois"],
    "label_in": InputPathType,
    "map": str,
    "cifti_out": str,
})


class CiftiAllLabelsToRoisOutputs(typing.NamedTuple):
    """
    Output object returned when calling `CiftiAllLabelsToRoisParameters(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    cifti_out: OutputPathType
    """the output cifti file"""


def cifti_all_labels_to_rois_params(
    label_in: InputPathType,
    map_: str,
    cifti_out: str,
) -> CiftiAllLabelsToRoisParametersTagged:
    """
    Build parameters.
    
    Args:
        label_in: the input cifti label file.
        map_: the number or name of the label map to use.
        cifti_out: the output cifti file.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "workbench/cifti-all-labels-to-rois",
        "label_in": label_in,
        "map": map_,
        "cifti_out": cifti_out,
    }
    return params


def cifti_all_labels_to_rois_cargs(
    params: CiftiAllLabelsToRoisParameters,
    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("-cifti-all-labels-to-rois")
    cargs.append(execution.input_file(params.get("label_in", None)))
    cargs.append(params.get("map", None))
    cargs.append(params.get("cifti_out", None))
    return cargs


def cifti_all_labels_to_rois_outputs(
    params: CiftiAllLabelsToRoisParameters,
    execution: Execution,
) -> CiftiAllLabelsToRoisOutputs:
    """
    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 = CiftiAllLabelsToRoisOutputs(
        root=execution.output_file("."),
        cifti_out=execution.output_file(params.get("cifti_out", None)),
    )
    return ret


def cifti_all_labels_to_rois_execute(
    params: CiftiAllLabelsToRoisParameters,
    runner: Runner | None = None,
) -> CiftiAllLabelsToRoisOutputs:
    """
    cifti-all-labels-to-rois
    
    Make rois from all labels in a cifti label map.
    
    The output cifti file is a dscalar file with a column (map) for each label
    in the specified input map, other than the ??? label, each of which contains
    a binary ROI of all brainordinates that are set to the corresponding label.
    
    Most of the time, specifying '1' for the <map> argument will do what is
    desired.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        params: The parameters.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `CiftiAllLabelsToRoisOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(CIFTI_ALL_LABELS_TO_ROIS_METADATA)
    params = execution.params(params)
    cargs = cifti_all_labels_to_rois_cargs(params, execution)
    ret = cifti_all_labels_to_rois_outputs(params, execution)
    execution.run(cargs)
    return ret


def cifti_all_labels_to_rois(
    label_in: InputPathType,
    map_: str,
    cifti_out: str,
    runner: Runner | None = None,
) -> CiftiAllLabelsToRoisOutputs:
    """
    cifti-all-labels-to-rois
    
    Make rois from all labels in a cifti label map.
    
    The output cifti file is a dscalar file with a column (map) for each label
    in the specified input map, other than the ??? label, each of which contains
    a binary ROI of all brainordinates that are set to the corresponding label.
    
    Most of the time, specifying '1' for the <map> argument will do what is
    desired.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        label_in: the input cifti label file.
        map_: the number or name of the label map to use.
        cifti_out: the output cifti file.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `CiftiAllLabelsToRoisOutputs`).
    """
    params = cifti_all_labels_to_rois_params(
        label_in=label_in,
        map_=map_,
        cifti_out=cifti_out,
    )
    return cifti_all_labels_to_rois_execute(params, runner)


__all__ = [
    "CIFTI_ALL_LABELS_TO_ROIS_METADATA",
    "CiftiAllLabelsToRoisOutputs",
    "cifti_all_labels_to_rois",
    "cifti_all_labels_to_rois_execute",
    "cifti_all_labels_to_rois_params",
]
