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

import typing
import pathlib
from styxdefs import *

CIFTI_PARCEL_MAPPING_TO_LABEL_METADATA = Metadata(
    id="0bf15c8c4c3f06d434147770f8cfca4d5d152ae9.boutiques",
    name="cifti-parcel-mapping-to-label",
    package="workbench",
    container_image_tag="brainlife/connectome_workbench:1.5.0-freesurfer-update",
)


CiftiParcelMappingToLabelParameters = typing.TypedDict('CiftiParcelMappingToLabelParameters', {
    "@type": typing.NotRequired[typing.Literal["workbench/cifti-parcel-mapping-to-label"]],
    "cifti_in": InputPathType,
    "direction": str,
    "template_cifti": InputPathType,
    "dlabel_out": str,
})
CiftiParcelMappingToLabelParametersTagged = typing.TypedDict('CiftiParcelMappingToLabelParametersTagged', {
    "@type": typing.Literal["workbench/cifti-parcel-mapping-to-label"],
    "cifti_in": InputPathType,
    "direction": str,
    "template_cifti": InputPathType,
    "dlabel_out": str,
})


class CiftiParcelMappingToLabelOutputs(typing.NamedTuple):
    """
    Output object returned when calling `CiftiParcelMappingToLabelParameters(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    dlabel_out: OutputPathType
    """the output dense label file"""


def cifti_parcel_mapping_to_label_params(
    cifti_in: InputPathType,
    direction: str,
    template_cifti: InputPathType,
    dlabel_out: str,
) -> CiftiParcelMappingToLabelParametersTagged:
    """
    Build parameters.
    
    Args:
        cifti_in: the input parcellated file.
        direction: which dimension to take the parcel map from, ROW or COLUMN.
        template_cifti: a cifti file with the desired dense mapping along\
            column.
        dlabel_out: the output dense label file.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "workbench/cifti-parcel-mapping-to-label",
        "cifti_in": cifti_in,
        "direction": direction,
        "template_cifti": template_cifti,
        "dlabel_out": dlabel_out,
    }
    return params


def cifti_parcel_mapping_to_label_cargs(
    params: CiftiParcelMappingToLabelParameters,
    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-parcel-mapping-to-label")
    cargs.append(execution.input_file(params.get("cifti_in", None)))
    cargs.append(params.get("direction", None))
    cargs.append(execution.input_file(params.get("template_cifti", None)))
    cargs.append(params.get("dlabel_out", None))
    return cargs


def cifti_parcel_mapping_to_label_outputs(
    params: CiftiParcelMappingToLabelParameters,
    execution: Execution,
) -> CiftiParcelMappingToLabelOutputs:
    """
    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 = CiftiParcelMappingToLabelOutputs(
        root=execution.output_file("."),
        dlabel_out=execution.output_file(params.get("dlabel_out", None)),
    )
    return ret


def cifti_parcel_mapping_to_label_execute(
    params: CiftiParcelMappingToLabelParameters,
    runner: Runner | None = None,
) -> CiftiParcelMappingToLabelOutputs:
    """
    cifti-parcel-mapping-to-label
    
    Create dlabel from parcellated file.
    
    This command will output a dlabel file, useful for doing the same
    parcellation to another dense file.
    
    For ptseries, pscalar, plabel, pconn, and pdconn, using COLUMN for
    <direction> will work.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        params: The parameters.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `CiftiParcelMappingToLabelOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(CIFTI_PARCEL_MAPPING_TO_LABEL_METADATA)
    params = execution.params(params)
    cargs = cifti_parcel_mapping_to_label_cargs(params, execution)
    ret = cifti_parcel_mapping_to_label_outputs(params, execution)
    execution.run(cargs)
    return ret


def cifti_parcel_mapping_to_label(
    cifti_in: InputPathType,
    direction: str,
    template_cifti: InputPathType,
    dlabel_out: str,
    runner: Runner | None = None,
) -> CiftiParcelMappingToLabelOutputs:
    """
    cifti-parcel-mapping-to-label
    
    Create dlabel from parcellated file.
    
    This command will output a dlabel file, useful for doing the same
    parcellation to another dense file.
    
    For ptseries, pscalar, plabel, pconn, and pdconn, using COLUMN for
    <direction> will work.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        cifti_in: the input parcellated file.
        direction: which dimension to take the parcel map from, ROW or COLUMN.
        template_cifti: a cifti file with the desired dense mapping along\
            column.
        dlabel_out: the output dense label file.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `CiftiParcelMappingToLabelOutputs`).
    """
    params = cifti_parcel_mapping_to_label_params(
        cifti_in=cifti_in,
        direction=direction,
        template_cifti=template_cifti,
        dlabel_out=dlabel_out,
    )
    return cifti_parcel_mapping_to_label_execute(params, runner)


__all__ = [
    "CIFTI_PARCEL_MAPPING_TO_LABEL_METADATA",
    "CiftiParcelMappingToLabelOutputs",
    "cifti_parcel_mapping_to_label",
    "cifti_parcel_mapping_to_label_execute",
    "cifti_parcel_mapping_to_label_params",
]
