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

import typing
import pathlib
from styxdefs import *

BACKEND_AVERAGE_ROI_CORRELATION_METADATA = Metadata(
    id="9178c51e54512af98ce12ec548335b4ce7759c19.boutiques",
    name="backend-average-roi-correlation",
    package="workbench",
    container_image_tag="brainlife/connectome_workbench:1.5.0-freesurfer-update",
)


BackendAverageRoiCorrelationParameters = typing.TypedDict('BackendAverageRoiCorrelationParameters', {
    "@type": typing.NotRequired[typing.Literal["workbench/backend-average-roi-correlation"]],
    "index_list": str,
    "out_file": str,
})
BackendAverageRoiCorrelationParametersTagged = typing.TypedDict('BackendAverageRoiCorrelationParametersTagged', {
    "@type": typing.Literal["workbench/backend-average-roi-correlation"],
    "index_list": str,
    "out_file": str,
})


class BackendAverageRoiCorrelationOutputs(typing.NamedTuple):
    """
    Output object returned when calling `BackendAverageRoiCorrelationParameters(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""


def backend_average_roi_correlation_params(
    index_list: str,
    out_file: str,
) -> BackendAverageRoiCorrelationParametersTagged:
    """
    Build parameters.
    
    Args:
        index_list: comma separated list of cifti indexes to average and then\
            correlate.
        out_file: file to write the average row to.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "workbench/backend-average-roi-correlation",
        "index_list": index_list,
        "out_file": out_file,
    }
    return params


def backend_average_roi_correlation_cargs(
    params: BackendAverageRoiCorrelationParameters,
    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("-backend-average-roi-correlation")
    cargs.append(params.get("index_list", None))
    cargs.append(params.get("out_file", None))
    return cargs


def backend_average_roi_correlation_outputs(
    params: BackendAverageRoiCorrelationParameters,
    execution: Execution,
) -> BackendAverageRoiCorrelationOutputs:
    """
    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 = BackendAverageRoiCorrelationOutputs(
        root=execution.output_file("."),
    )
    return ret


def backend_average_roi_correlation_execute(
    params: BackendAverageRoiCorrelationParameters,
    runner: Runner | None = None,
) -> BackendAverageRoiCorrelationOutputs:
    """
    backend-average-roi-correlation
    
    Connectome db backend command for cifti average roi correlation.
    
    This command is probably not the one you are looking for, try
    -cifti-average-roi-correlation. It takes the list of cifti files to average
    from standard input, and writes its output as little endian, 32-bit integer
    of row size followed by the row as 32-bit floats.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        params: The parameters.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `BackendAverageRoiCorrelationOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(BACKEND_AVERAGE_ROI_CORRELATION_METADATA)
    params = execution.params(params)
    cargs = backend_average_roi_correlation_cargs(params, execution)
    ret = backend_average_roi_correlation_outputs(params, execution)
    execution.run(cargs)
    return ret


def backend_average_roi_correlation(
    index_list: str,
    out_file: str,
    runner: Runner | None = None,
) -> BackendAverageRoiCorrelationOutputs:
    """
    backend-average-roi-correlation
    
    Connectome db backend command for cifti average roi correlation.
    
    This command is probably not the one you are looking for, try
    -cifti-average-roi-correlation. It takes the list of cifti files to average
    from standard input, and writes its output as little endian, 32-bit integer
    of row size followed by the row as 32-bit floats.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        index_list: comma separated list of cifti indexes to average and then\
            correlate.
        out_file: file to write the average row to.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `BackendAverageRoiCorrelationOutputs`).
    """
    params = backend_average_roi_correlation_params(
        index_list=index_list,
        out_file=out_file,
    )
    return backend_average_roi_correlation_execute(params, runner)


__all__ = [
    "BACKEND_AVERAGE_ROI_CORRELATION_METADATA",
    "BackendAverageRoiCorrelationOutputs",
    "backend_average_roi_correlation",
    "backend_average_roi_correlation_execute",
    "backend_average_roi_correlation_params",
]
