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

import typing
import pathlib
from styxdefs import *

CIFTI_CREATE_DENSE_SCALAR_METADATA = Metadata(
    id="9ba9ea5f5543f7bd7ad9a5ecd9cfcec3a37b90da.boutiques",
    name="cifti-create-dense-scalar",
    package="workbench",
    container_image_tag="brainlife/connectome_workbench:1.5.0-freesurfer-update",
)


CiftiCreateDenseScalarVolumeParameters = typing.TypedDict('CiftiCreateDenseScalarVolumeParameters', {
    "@type": typing.NotRequired[typing.Literal["volume"]],
    "volume_data": InputPathType,
    "structure_label_volume": InputPathType,
})
CiftiCreateDenseScalarVolumeParametersTagged = typing.TypedDict('CiftiCreateDenseScalarVolumeParametersTagged', {
    "@type": typing.Literal["volume"],
    "volume_data": InputPathType,
    "structure_label_volume": InputPathType,
})


CiftiCreateDenseScalarLeftMetricParameters = typing.TypedDict('CiftiCreateDenseScalarLeftMetricParameters', {
    "@type": typing.NotRequired[typing.Literal["left_metric"]],
    "metric": InputPathType,
    "opt_roi_left_roi_metric": typing.NotRequired[InputPathType | None],
})
CiftiCreateDenseScalarLeftMetricParametersTagged = typing.TypedDict('CiftiCreateDenseScalarLeftMetricParametersTagged', {
    "@type": typing.Literal["left_metric"],
    "metric": InputPathType,
    "opt_roi_left_roi_metric": typing.NotRequired[InputPathType | None],
})


CiftiCreateDenseScalarRightMetricParameters = typing.TypedDict('CiftiCreateDenseScalarRightMetricParameters', {
    "@type": typing.NotRequired[typing.Literal["right_metric"]],
    "metric": InputPathType,
    "opt_roi_right_roi_metric": typing.NotRequired[InputPathType | None],
})
CiftiCreateDenseScalarRightMetricParametersTagged = typing.TypedDict('CiftiCreateDenseScalarRightMetricParametersTagged', {
    "@type": typing.Literal["right_metric"],
    "metric": InputPathType,
    "opt_roi_right_roi_metric": typing.NotRequired[InputPathType | None],
})


CiftiCreateDenseScalarCerebellumMetricParameters = typing.TypedDict('CiftiCreateDenseScalarCerebellumMetricParameters', {
    "@type": typing.NotRequired[typing.Literal["cerebellum_metric"]],
    "metric": InputPathType,
    "opt_roi_cerebellum_roi_metric": typing.NotRequired[InputPathType | None],
})
CiftiCreateDenseScalarCerebellumMetricParametersTagged = typing.TypedDict('CiftiCreateDenseScalarCerebellumMetricParametersTagged', {
    "@type": typing.Literal["cerebellum_metric"],
    "metric": InputPathType,
    "opt_roi_cerebellum_roi_metric": typing.NotRequired[InputPathType | None],
})


CiftiCreateDenseScalarParameters = typing.TypedDict('CiftiCreateDenseScalarParameters', {
    "@type": typing.NotRequired[typing.Literal["workbench/cifti-create-dense-scalar"]],
    "cifti_out": str,
    "volume": typing.NotRequired[CiftiCreateDenseScalarVolumeParameters | None],
    "left_metric": typing.NotRequired[CiftiCreateDenseScalarLeftMetricParameters | None],
    "right_metric": typing.NotRequired[CiftiCreateDenseScalarRightMetricParameters | None],
    "cerebellum_metric": typing.NotRequired[CiftiCreateDenseScalarCerebellumMetricParameters | None],
    "opt_name_file_file": typing.NotRequired[str | None],
})
CiftiCreateDenseScalarParametersTagged = typing.TypedDict('CiftiCreateDenseScalarParametersTagged', {
    "@type": typing.Literal["workbench/cifti-create-dense-scalar"],
    "cifti_out": str,
    "volume": typing.NotRequired[CiftiCreateDenseScalarVolumeParameters | None],
    "left_metric": typing.NotRequired[CiftiCreateDenseScalarLeftMetricParameters | None],
    "right_metric": typing.NotRequired[CiftiCreateDenseScalarRightMetricParameters | None],
    "cerebellum_metric": typing.NotRequired[CiftiCreateDenseScalarCerebellumMetricParameters | None],
    "opt_name_file_file": typing.NotRequired[str | None],
})


def cifti_create_dense_scalar_volume_params(
    volume_data: InputPathType,
    structure_label_volume: InputPathType,
) -> CiftiCreateDenseScalarVolumeParametersTagged:
    """
    Build parameters.
    
    Args:
        volume_data: volume file containing all voxel data for all volume\
            structures.
        structure_label_volume: label volume file containing labels for cifti\
            structures.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "volume",
        "volume_data": volume_data,
        "structure_label_volume": structure_label_volume,
    }
    return params


def cifti_create_dense_scalar_volume_cargs(
    params: CiftiCreateDenseScalarVolumeParameters,
    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("-volume")
    cargs.append(execution.input_file(params.get("volume_data", None)))
    cargs.append(execution.input_file(params.get("structure_label_volume", None)))
    return cargs


def cifti_create_dense_scalar_left_metric_params(
    metric: InputPathType,
    opt_roi_left_roi_metric: InputPathType | None = None,
) -> CiftiCreateDenseScalarLeftMetricParametersTagged:
    """
    Build parameters.
    
    Args:
        metric: the metric file.
        opt_roi_left_roi_metric: roi of vertices to use from left surface: the\
            ROI as a metric file.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "left_metric",
        "metric": metric,
    }
    if opt_roi_left_roi_metric is not None:
        params["opt_roi_left_roi_metric"] = opt_roi_left_roi_metric
    return params


def cifti_create_dense_scalar_left_metric_cargs(
    params: CiftiCreateDenseScalarLeftMetricParameters,
    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("-left-metric")
    cargs.append(execution.input_file(params.get("metric", None)))
    if params.get("opt_roi_left_roi_metric", None) is not None:
        cargs.extend([
            "-roi-left",
            execution.input_file(params.get("opt_roi_left_roi_metric", None))
        ])
    return cargs


def cifti_create_dense_scalar_right_metric_params(
    metric: InputPathType,
    opt_roi_right_roi_metric: InputPathType | None = None,
) -> CiftiCreateDenseScalarRightMetricParametersTagged:
    """
    Build parameters.
    
    Args:
        metric: the metric file.
        opt_roi_right_roi_metric: roi of vertices to use from right surface:\
            the ROI as a metric file.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "right_metric",
        "metric": metric,
    }
    if opt_roi_right_roi_metric is not None:
        params["opt_roi_right_roi_metric"] = opt_roi_right_roi_metric
    return params


def cifti_create_dense_scalar_right_metric_cargs(
    params: CiftiCreateDenseScalarRightMetricParameters,
    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("-right-metric")
    cargs.append(execution.input_file(params.get("metric", None)))
    if params.get("opt_roi_right_roi_metric", None) is not None:
        cargs.extend([
            "-roi-right",
            execution.input_file(params.get("opt_roi_right_roi_metric", None))
        ])
    return cargs


def cifti_create_dense_scalar_cerebellum_metric_params(
    metric: InputPathType,
    opt_roi_cerebellum_roi_metric: InputPathType | None = None,
) -> CiftiCreateDenseScalarCerebellumMetricParametersTagged:
    """
    Build parameters.
    
    Args:
        metric: the metric file.
        opt_roi_cerebellum_roi_metric: roi of vertices to use from right\
            surface: the ROI as a metric file.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "cerebellum_metric",
        "metric": metric,
    }
    if opt_roi_cerebellum_roi_metric is not None:
        params["opt_roi_cerebellum_roi_metric"] = opt_roi_cerebellum_roi_metric
    return params


def cifti_create_dense_scalar_cerebellum_metric_cargs(
    params: CiftiCreateDenseScalarCerebellumMetricParameters,
    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("-cerebellum-metric")
    cargs.append(execution.input_file(params.get("metric", None)))
    if params.get("opt_roi_cerebellum_roi_metric", None) is not None:
        cargs.extend([
            "-roi-cerebellum",
            execution.input_file(params.get("opt_roi_cerebellum_roi_metric", None))
        ])
    return cargs


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


def cifti_create_dense_scalar_params(
    cifti_out: str,
    volume: CiftiCreateDenseScalarVolumeParameters | None = None,
    left_metric: CiftiCreateDenseScalarLeftMetricParameters | None = None,
    right_metric: CiftiCreateDenseScalarRightMetricParameters | None = None,
    cerebellum_metric: CiftiCreateDenseScalarCerebellumMetricParameters | None = None,
    opt_name_file_file: str | None = None,
) -> CiftiCreateDenseScalarParametersTagged:
    """
    Build parameters.
    
    Args:
        cifti_out: the output cifti file.
        volume: volume component.
        left_metric: metric for left surface.
        right_metric: metric for right surface.
        cerebellum_metric: metric for the cerebellum.
        opt_name_file_file: use a text file to set all map names: text file\
            containing map names, one per line.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "workbench/cifti-create-dense-scalar",
        "cifti_out": cifti_out,
    }
    if volume is not None:
        params["volume"] = volume
    if left_metric is not None:
        params["left_metric"] = left_metric
    if right_metric is not None:
        params["right_metric"] = right_metric
    if cerebellum_metric is not None:
        params["cerebellum_metric"] = cerebellum_metric
    if opt_name_file_file is not None:
        params["opt_name_file_file"] = opt_name_file_file
    return params


def cifti_create_dense_scalar_cargs(
    params: CiftiCreateDenseScalarParameters,
    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-create-dense-scalar")
    cargs.append(params.get("cifti_out", None))
    if params.get("volume", None) is not None:
        cargs.extend(cifti_create_dense_scalar_volume_cargs(params.get("volume", None), execution))
    if params.get("left_metric", None) is not None:
        cargs.extend(cifti_create_dense_scalar_left_metric_cargs(params.get("left_metric", None), execution))
    if params.get("right_metric", None) is not None:
        cargs.extend(cifti_create_dense_scalar_right_metric_cargs(params.get("right_metric", None), execution))
    if params.get("cerebellum_metric", None) is not None:
        cargs.extend(cifti_create_dense_scalar_cerebellum_metric_cargs(params.get("cerebellum_metric", None), execution))
    if params.get("opt_name_file_file", None) is not None:
        cargs.extend([
            "-name-file",
            params.get("opt_name_file_file", None)
        ])
    return cargs


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


def cifti_create_dense_scalar_execute(
    params: CiftiCreateDenseScalarParameters,
    runner: Runner | None = None,
) -> CiftiCreateDenseScalarOutputs:
    """
    cifti-create-dense-scalar
    
    Create a cifti dense scalar file.
    
    All input files must have the same number of columns/subvolumes. Only the
    specified components will be in the output cifti file. Map names will be
    taken from one of the input files. At least one component must be specified.
    
    See -volume-label-import and -volume-help for format details of label volume
    files. The structure-label-volume should have some of the label names from
    this list, all other label names will be ignored:
    
    CORTEX_LEFT
    CORTEX_RIGHT
    CEREBELLUM
    ACCUMBENS_LEFT
    ACCUMBENS_RIGHT
    ALL_GREY_MATTER
    ALL_WHITE_MATTER
    AMYGDALA_LEFT
    AMYGDALA_RIGHT
    BRAIN_STEM
    CAUDATE_LEFT
    CAUDATE_RIGHT
    CEREBELLAR_WHITE_MATTER_LEFT
    CEREBELLAR_WHITE_MATTER_RIGHT
    CEREBELLUM_LEFT
    CEREBELLUM_RIGHT
    CEREBRAL_WHITE_MATTER_LEFT
    CEREBRAL_WHITE_MATTER_RIGHT
    CORTEX
    DIENCEPHALON_VENTRAL_LEFT
    DIENCEPHALON_VENTRAL_RIGHT
    HIPPOCAMPUS_LEFT
    HIPPOCAMPUS_RIGHT
    INVALID
    OTHER
    OTHER_GREY_MATTER
    OTHER_WHITE_MATTER
    PALLIDUM_LEFT
    PALLIDUM_RIGHT
    PUTAMEN_LEFT
    PUTAMEN_RIGHT
    THALAMUS_LEFT
    THALAMUS_RIGHT.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        params: The parameters.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `CiftiCreateDenseScalarOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(CIFTI_CREATE_DENSE_SCALAR_METADATA)
    params = execution.params(params)
    cargs = cifti_create_dense_scalar_cargs(params, execution)
    ret = cifti_create_dense_scalar_outputs(params, execution)
    execution.run(cargs)
    return ret


def cifti_create_dense_scalar(
    cifti_out: str,
    volume: CiftiCreateDenseScalarVolumeParameters | None = None,
    left_metric: CiftiCreateDenseScalarLeftMetricParameters | None = None,
    right_metric: CiftiCreateDenseScalarRightMetricParameters | None = None,
    cerebellum_metric: CiftiCreateDenseScalarCerebellumMetricParameters | None = None,
    opt_name_file_file: str | None = None,
    runner: Runner | None = None,
) -> CiftiCreateDenseScalarOutputs:
    """
    cifti-create-dense-scalar
    
    Create a cifti dense scalar file.
    
    All input files must have the same number of columns/subvolumes. Only the
    specified components will be in the output cifti file. Map names will be
    taken from one of the input files. At least one component must be specified.
    
    See -volume-label-import and -volume-help for format details of label volume
    files. The structure-label-volume should have some of the label names from
    this list, all other label names will be ignored:
    
    CORTEX_LEFT
    CORTEX_RIGHT
    CEREBELLUM
    ACCUMBENS_LEFT
    ACCUMBENS_RIGHT
    ALL_GREY_MATTER
    ALL_WHITE_MATTER
    AMYGDALA_LEFT
    AMYGDALA_RIGHT
    BRAIN_STEM
    CAUDATE_LEFT
    CAUDATE_RIGHT
    CEREBELLAR_WHITE_MATTER_LEFT
    CEREBELLAR_WHITE_MATTER_RIGHT
    CEREBELLUM_LEFT
    CEREBELLUM_RIGHT
    CEREBRAL_WHITE_MATTER_LEFT
    CEREBRAL_WHITE_MATTER_RIGHT
    CORTEX
    DIENCEPHALON_VENTRAL_LEFT
    DIENCEPHALON_VENTRAL_RIGHT
    HIPPOCAMPUS_LEFT
    HIPPOCAMPUS_RIGHT
    INVALID
    OTHER
    OTHER_GREY_MATTER
    OTHER_WHITE_MATTER
    PALLIDUM_LEFT
    PALLIDUM_RIGHT
    PUTAMEN_LEFT
    PUTAMEN_RIGHT
    THALAMUS_LEFT
    THALAMUS_RIGHT.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        cifti_out: the output cifti file.
        volume: volume component.
        left_metric: metric for left surface.
        right_metric: metric for right surface.
        cerebellum_metric: metric for the cerebellum.
        opt_name_file_file: use a text file to set all map names: text file\
            containing map names, one per line.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `CiftiCreateDenseScalarOutputs`).
    """
    params = cifti_create_dense_scalar_params(
        cifti_out=cifti_out,
        volume=volume,
        left_metric=left_metric,
        right_metric=right_metric,
        cerebellum_metric=cerebellum_metric,
        opt_name_file_file=opt_name_file_file,
    )
    return cifti_create_dense_scalar_execute(params, runner)


__all__ = [
    "CIFTI_CREATE_DENSE_SCALAR_METADATA",
    "CiftiCreateDenseScalarOutputs",
    "cifti_create_dense_scalar",
    "cifti_create_dense_scalar_cerebellum_metric_params",
    "cifti_create_dense_scalar_execute",
    "cifti_create_dense_scalar_left_metric_params",
    "cifti_create_dense_scalar_params",
    "cifti_create_dense_scalar_right_metric_params",
    "cifti_create_dense_scalar_volume_params",
]
