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

import typing
import pathlib
from styxdefs import *

TIME_SCCAN_METADATA = Metadata(
    id="df24e51b7f0bd36e46f31654254028b83351eca4.boutiques",
    name="TimeSCCAN",
    package="ants",
    container_image_tag="antsx/ants:v2.5.3",
)


_TimeSccanTimeseriesimageToMatrixParamsDictNoTag = typing.TypedDict('_TimeSccanTimeseriesimageToMatrixParamsDictNoTag', {
    "timeseries_image": InputPathType,
    "mask_image": InputPathType,
})
TimeSccanTimeseriesimageToMatrixParamsDictTagged = typing.TypedDict('TimeSccanTimeseriesimageToMatrixParamsDictTagged', {
    "@type": typing.Literal["timeseriesimage_to_matrix"],
    "timeseries_image": InputPathType,
    "mask_image": InputPathType,
})
TimeSccanTimeseriesimageToMatrixParamsDict = _TimeSccanTimeseriesimageToMatrixParamsDictNoTag | TimeSccanTimeseriesimageToMatrixParamsDictTagged


_TimeSccanNetworkSccaParamsDictNoTag = typing.TypedDict('_TimeSccanNetworkSccaParamsDictNoTag', {
    "time_matrix": InputPathType,
    "label_matrix": InputPathType,
})
TimeSccanNetworkSccaParamsDictTagged = typing.TypedDict('TimeSccanNetworkSccaParamsDictTagged', {
    "@type": typing.Literal["network_scca"],
    "time_matrix": InputPathType,
    "label_matrix": InputPathType,
})
TimeSccanNetworkSccaParamsDict = _TimeSccanNetworkSccaParamsDictNoTag | TimeSccanNetworkSccaParamsDictTagged


_TimeSccanNetworkRegionAveragingParamsDictNoTag = typing.TypedDict('_TimeSccanNetworkRegionAveragingParamsDictNoTag', {
    "time_matrix": InputPathType,
    "label_matrix": InputPathType,
})
TimeSccanNetworkRegionAveragingParamsDictTagged = typing.TypedDict('TimeSccanNetworkRegionAveragingParamsDictTagged', {
    "@type": typing.Literal["network_region_averaging"],
    "time_matrix": InputPathType,
    "label_matrix": InputPathType,
})
TimeSccanNetworkRegionAveragingParamsDict = _TimeSccanNetworkRegionAveragingParamsDictNoTag | TimeSccanNetworkRegionAveragingParamsDictTagged


_TimeSccanParamsDictNoTag = typing.TypedDict('_TimeSccanParamsDictNoTag', {
    "output": str,
    "number_consecutive_labels": typing.NotRequired[int | None],
    "minimum_region_size": typing.NotRequired[int | None],
    "iterations": typing.NotRequired[int | None],
    "sparsity": typing.NotRequired[float | None],
    "n_eigenvectors": typing.NotRequired[int | None],
    "robustify": typing.NotRequired[int | None],
    "l1": typing.NotRequired[float | None],
    "cluster_thresh": typing.NotRequired[int | None],
    "ridge_cca": typing.NotRequired[int | None],
    "partial_scca_option": typing.NotRequired[typing.Literal["PQ", "PminusRQ", "PQminusR", "PminusRQminusR"] | None],
    "timeseriesimage_to_matrix": typing.NotRequired[TimeSccanTimeseriesimageToMatrixParamsDict | None],
    "labelsimage_to_matrix": typing.NotRequired[InputPathType | None],
    "network": typing.NotRequired[typing.Union[TimeSccanNetworkSccaParamsDictTagged, TimeSccanNetworkRegionAveragingParamsDictTagged] | None],
})
TimeSccanParamsDictTagged = typing.TypedDict('TimeSccanParamsDictTagged', {
    "@type": typing.Literal["ants/TimeSCCAN"],
    "output": str,
    "number_consecutive_labels": typing.NotRequired[int | None],
    "minimum_region_size": typing.NotRequired[int | None],
    "iterations": typing.NotRequired[int | None],
    "sparsity": typing.NotRequired[float | None],
    "n_eigenvectors": typing.NotRequired[int | None],
    "robustify": typing.NotRequired[int | None],
    "l1": typing.NotRequired[float | None],
    "cluster_thresh": typing.NotRequired[int | None],
    "ridge_cca": typing.NotRequired[int | None],
    "partial_scca_option": typing.NotRequired[typing.Literal["PQ", "PminusRQ", "PQminusR", "PminusRQminusR"] | None],
    "timeseriesimage_to_matrix": typing.NotRequired[TimeSccanTimeseriesimageToMatrixParamsDict | None],
    "labelsimage_to_matrix": typing.NotRequired[InputPathType | None],
    "network": typing.NotRequired[typing.Union[TimeSccanNetworkSccaParamsDictTagged, TimeSccanNetworkRegionAveragingParamsDictTagged] | None],
})
TimeSccanParamsDict = _TimeSccanParamsDictNoTag | TimeSccanParamsDictTagged


def time_sccan_network_cargs_dyn_fn(
    t: str,
) -> typing.Any:
    """
    Get build cargs function by command type.
    
    Args:
        t: Command type.
    Returns:
        Build cargs function.
    """
    return {
        "network_scca": time_sccan_network_scca_cargs,
        "network_region_averaging": time_sccan_network_region_averaging_cargs,
    }.get(t)


def time_sccan_network_validate_dyn_fn(
    t: str,
) -> typing.Any:
    """
    Get validate params function by command type.
    
    Args:
        t: Command type.
    Returns:
        Validate params function.
    """
    return {
        "network_scca": time_sccan_network_scca_validate,
        "network_region_averaging": time_sccan_network_region_averaging_validate,
    }.get(t)


def time_sccan_timeseriesimage_to_matrix(
    timeseries_image: InputPathType,
    mask_image: InputPathType,
) -> TimeSccanTimeseriesimageToMatrixParamsDictTagged:
    """
    Build parameters.
    
    Args:
        timeseries_image:.
        mask_image:.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "timeseriesimage_to_matrix",
        "timeseries_image": timeseries_image,
        "mask_image": mask_image,
    }
    return params


def time_sccan_timeseriesimage_to_matrix_validate(
    params: typing.Any,
) -> None:
    """
    Validate parameters. Throws an error if `params` is not a valid
    `TimeSccanTimeseriesimageToMatrixParamsDict` object.
    
    Args:
        params: The parameters object to validate.
    """
    if params is None or not isinstance(params, dict):
        raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
    if params.get("timeseries_image", None) is None:
        raise StyxValidationError("`timeseries_image` must not be None")
    if not isinstance(params["timeseries_image"], (pathlib.Path, str)):
        raise StyxValidationError(f'`timeseries_image` has the wrong type: Received `{type(params.get("timeseries_image", None))}` expected `InputPathType`')
    if params.get("mask_image", None) is None:
        raise StyxValidationError("`mask_image` must not be None")
    if not isinstance(params["mask_image"], (pathlib.Path, str)):
        raise StyxValidationError(f'`mask_image` has the wrong type: Received `{type(params.get("mask_image", None))}` expected `InputPathType`')


def time_sccan_timeseriesimage_to_matrix_cargs(
    params: TimeSccanTimeseriesimageToMatrixParamsDict,
    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(execution.input_file(params.get("timeseries_image", None)) + execution.input_file(params.get("mask_image", None)))
    return cargs


def time_sccan_network_scca(
    time_matrix: InputPathType,
    label_matrix: InputPathType,
) -> TimeSccanNetworkSccaParamsDictTagged:
    """
    Build parameters.
    
    Args:
        time_matrix:.
        label_matrix:.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "network_scca",
        "time_matrix": time_matrix,
        "label_matrix": label_matrix,
    }
    return params


def time_sccan_network_scca_validate(
    params: typing.Any,
) -> None:
    """
    Validate parameters. Throws an error if `params` is not a valid
    `TimeSccanNetworkSccaParamsDict` object.
    
    Args:
        params: The parameters object to validate.
    """
    if params is None or not isinstance(params, dict):
        raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
    if params.get("time_matrix", None) is None:
        raise StyxValidationError("`time_matrix` must not be None")
    if not isinstance(params["time_matrix"], (pathlib.Path, str)):
        raise StyxValidationError(f'`time_matrix` has the wrong type: Received `{type(params.get("time_matrix", None))}` expected `InputPathType`')
    if params.get("label_matrix", None) is None:
        raise StyxValidationError("`label_matrix` must not be None")
    if not isinstance(params["label_matrix"], (pathlib.Path, str)):
        raise StyxValidationError(f'`label_matrix` has the wrong type: Received `{type(params.get("label_matrix", None))}` expected `InputPathType`')


def time_sccan_network_scca_cargs(
    params: TimeSccanNetworkSccaParamsDict,
    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("scca[" + execution.input_file(params.get("time_matrix", None)) + "," + execution.input_file(params.get("label_matrix", None)) + "]")
    return cargs


def time_sccan_network_region_averaging(
    time_matrix: InputPathType,
    label_matrix: InputPathType,
) -> TimeSccanNetworkRegionAveragingParamsDictTagged:
    """
    Build parameters.
    
    Args:
        time_matrix:.
        label_matrix:.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "network_region_averaging",
        "time_matrix": time_matrix,
        "label_matrix": label_matrix,
    }
    return params


def time_sccan_network_region_averaging_validate(
    params: typing.Any,
) -> None:
    """
    Validate parameters. Throws an error if `params` is not a valid
    `TimeSccanNetworkRegionAveragingParamsDict` object.
    
    Args:
        params: The parameters object to validate.
    """
    if params is None or not isinstance(params, dict):
        raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
    if params.get("time_matrix", None) is None:
        raise StyxValidationError("`time_matrix` must not be None")
    if not isinstance(params["time_matrix"], (pathlib.Path, str)):
        raise StyxValidationError(f'`time_matrix` has the wrong type: Received `{type(params.get("time_matrix", None))}` expected `InputPathType`')
    if params.get("label_matrix", None) is None:
        raise StyxValidationError("`label_matrix` must not be None")
    if not isinstance(params["label_matrix"], (pathlib.Path, str)):
        raise StyxValidationError(f'`label_matrix` has the wrong type: Received `{type(params.get("label_matrix", None))}` expected `InputPathType`')


def time_sccan_network_region_averaging_cargs(
    params: TimeSccanNetworkRegionAveragingParamsDict,
    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("region-averaging[" + execution.input_file(params.get("time_matrix", None)) + "," + execution.input_file(params.get("label_matrix", None)) + "]")
    return cargs


class TimeSccanOutputs(typing.NamedTuple):
    """
    Output object returned when calling `TimeSccanParamsDict(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    correlation_matrix: OutputPathType
    """The output is the 2D correlation matrix."""


def time_sccan_params(
    output: str,
    number_consecutive_labels: int | None = None,
    minimum_region_size: int | None = None,
    iterations: int | None = None,
    sparsity: float | None = None,
    n_eigenvectors: int | None = None,
    robustify: int | None = None,
    l1: float | None = None,
    cluster_thresh: int | None = None,
    ridge_cca: int | None = None,
    partial_scca_option: typing.Literal["PQ", "PminusRQ", "PQminusR", "PminusRQminusR"] | None = None,
    timeseriesimage_to_matrix: TimeSccanTimeseriesimageToMatrixParamsDict | None = None,
    labelsimage_to_matrix: InputPathType | None = None,
    network: typing.Union[TimeSccanNetworkSccaParamsDictTagged, TimeSccanNetworkRegionAveragingParamsDictTagged] | None = None,
) -> TimeSccanParamsDictTagged:
    """
    Build parameters.
    
    Args:
        output: Output is a 2D correlation matrix.
        number_consecutive_labels: Number of consecutive labels in data.
        minimum_region_size: Minimum size of a region: regions below this size\
            are given a 0.0 connectivity value.
        iterations: Number of iterations.
        sparsity: Sparsity - a float from (0,1] indicating what fraction of the\
            data to use.
        n_eigenvectors: Number of permutations to use in scca.
        robustify: Rank-based scca.
        l1: Use l1 ( > 0 ) or l0 ( < 0 ) penalty, also sets gradient step size\
            e.g. -l 0.5 ( L1 ) , -l -0.5 (L0) will set 0.5 grad descent step for\
            either penalty.
        cluster_thresh: Cluster threshold on view P.
        ridge_cca: Number of permutations to use in scca.
        partial_scca_option: Choices for partial SCCA: PQ, PminusRQ, PQminusR,\
            PminusRQminusR.
        timeseriesimage_to_matrix: Takes a timeseries (4D) image and converts\
            it to a 2D matrix csv format as output. If the mask has multiple labels\
            (more than one), then the average time series in each label will be\
            computed and put in the csv.
        labelsimage_to_matrix: Takes a labeled (3D) image and converts it to a\
            2D matrix csv format as output.
        network: Build the network connectivity matrix.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "ants/TimeSCCAN",
        "output": output,
    }
    if number_consecutive_labels is not None:
        params["number_consecutive_labels"] = number_consecutive_labels
    if minimum_region_size is not None:
        params["minimum_region_size"] = minimum_region_size
    if iterations is not None:
        params["iterations"] = iterations
    if sparsity is not None:
        params["sparsity"] = sparsity
    if n_eigenvectors is not None:
        params["n_eigenvectors"] = n_eigenvectors
    if robustify is not None:
        params["robustify"] = robustify
    if l1 is not None:
        params["l1"] = l1
    if cluster_thresh is not None:
        params["cluster_thresh"] = cluster_thresh
    if ridge_cca is not None:
        params["ridge_cca"] = ridge_cca
    if partial_scca_option is not None:
        params["partial_scca_option"] = partial_scca_option
    if timeseriesimage_to_matrix is not None:
        params["timeseriesimage_to_matrix"] = timeseriesimage_to_matrix
    if labelsimage_to_matrix is not None:
        params["labelsimage_to_matrix"] = labelsimage_to_matrix
    if network is not None:
        params["network"] = network
    return params


def time_sccan_validate(
    params: typing.Any,
) -> None:
    """
    Validate parameters. Throws an error if `params` is not a valid
    `TimeSccanParamsDict` object.
    
    Args:
        params: The parameters object to validate.
    """
    if params is None or not isinstance(params, dict):
        raise StyxValidationError(f'Params object has the wrong type \'{type(params)}\'')
    if params.get("output", None) is None:
        raise StyxValidationError("`output` must not be None")
    if not isinstance(params["output"], str):
        raise StyxValidationError(f'`output` has the wrong type: Received `{type(params.get("output", None))}` expected `str`')
    if params.get("number_consecutive_labels", None) is not None:
        if not isinstance(params["number_consecutive_labels"], int):
            raise StyxValidationError(f'`number_consecutive_labels` has the wrong type: Received `{type(params.get("number_consecutive_labels", None))}` expected `int | None`')
    if params.get("minimum_region_size", None) is not None:
        if not isinstance(params["minimum_region_size"], int):
            raise StyxValidationError(f'`minimum_region_size` has the wrong type: Received `{type(params.get("minimum_region_size", None))}` expected `int | None`')
    if params.get("iterations", None) is not None:
        if not isinstance(params["iterations"], int):
            raise StyxValidationError(f'`iterations` has the wrong type: Received `{type(params.get("iterations", None))}` expected `int | None`')
    if params.get("sparsity", None) is not None:
        if not isinstance(params["sparsity"], (float, int)):
            raise StyxValidationError(f'`sparsity` has the wrong type: Received `{type(params.get("sparsity", None))}` expected `float | None`')
    if params.get("n_eigenvectors", None) is not None:
        if not isinstance(params["n_eigenvectors"], int):
            raise StyxValidationError(f'`n_eigenvectors` has the wrong type: Received `{type(params.get("n_eigenvectors", None))}` expected `int | None`')
    if params.get("robustify", None) is not None:
        if not isinstance(params["robustify"], int):
            raise StyxValidationError(f'`robustify` has the wrong type: Received `{type(params.get("robustify", None))}` expected `int | None`')
    if params.get("l1", None) is not None:
        if not isinstance(params["l1"], (float, int)):
            raise StyxValidationError(f'`l1` has the wrong type: Received `{type(params.get("l1", None))}` expected `float | None`')
    if params.get("cluster_thresh", None) is not None:
        if not isinstance(params["cluster_thresh"], int):
            raise StyxValidationError(f'`cluster_thresh` has the wrong type: Received `{type(params.get("cluster_thresh", None))}` expected `int | None`')
    if params.get("ridge_cca", None) is not None:
        if not isinstance(params["ridge_cca"], int):
            raise StyxValidationError(f'`ridge_cca` has the wrong type: Received `{type(params.get("ridge_cca", None))}` expected `int | None`')
    if params.get("partial_scca_option", None) is not None:
        if not isinstance(params["partial_scca_option"], str):
            raise StyxValidationError(f'`partial_scca_option` has the wrong type: Received `{type(params.get("partial_scca_option", None))}` expected `typing.Literal["PQ", "PminusRQ", "PQminusR", "PminusRQminusR"] | None`')
        if params["partial_scca_option"] not in ["PQ", "PminusRQ", "PQminusR", "PminusRQminusR"]:
            raise StyxValidationError("Parameter `partial_scca_option` must be one of [\"PQ\", \"PminusRQ\", \"PQminusR\", \"PminusRQminusR\"]")
    if params.get("timeseriesimage_to_matrix", None) is not None:
        time_sccan_timeseriesimage_to_matrix_validate(params["timeseriesimage_to_matrix"])
    if params.get("labelsimage_to_matrix", None) is not None:
        if not isinstance(params["labelsimage_to_matrix"], (pathlib.Path, str)):
            raise StyxValidationError(f'`labelsimage_to_matrix` has the wrong type: Received `{type(params.get("labelsimage_to_matrix", None))}` expected `InputPathType | None`')
    if params.get("network", None) is not None:
        if not isinstance(params["network"], dict):
            raise StyxValidationError(f'Params object has the wrong type \'{type(params["network"])}\'')
        if "@type" not in params["network"]:
            raise StyxValidationError("Params object is missing `@type`")
        if params["network"]["@type"] not in ["network_scca", "network_region_averaging"]:
            raise StyxValidationError("Parameter `network`s `@type` must be one of [\"network_scca\", \"network_region_averaging\"]")
        time_sccan_network_validate_dyn_fn(params["network"]["@type"])(params["network"])


def time_sccan_cargs(
    params: TimeSccanParamsDict,
    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("TimeSCCAN")
    cargs.extend([
        "--output",
        params.get("output", None)
    ])
    if params.get("number_consecutive_labels", None) is not None:
        cargs.extend([
            "-l",
            str(params.get("number_consecutive_labels", None))
        ])
    if params.get("minimum_region_size", None) is not None:
        cargs.extend([
            "-R",
            str(params.get("minimum_region_size", None))
        ])
    if params.get("iterations", None) is not None:
        cargs.extend([
            "-i",
            str(params.get("iterations", None))
        ])
    if params.get("sparsity", None) is not None:
        cargs.extend([
            "-s",
            str(params.get("sparsity", None))
        ])
    if params.get("n_eigenvectors", None) is not None:
        cargs.extend([
            "-n",
            str(params.get("n_eigenvectors", None))
        ])
    if params.get("robustify", None) is not None:
        cargs.extend([
            "-r",
            str(params.get("robustify", None))
        ])
    if params.get("l1", None) is not None:
        cargs.extend([
            "-l",
            str(params.get("l1", None))
        ])
    if params.get("cluster_thresh", None) is not None:
        cargs.extend([
            "--ClusterThresh",
            str(params.get("cluster_thresh", None))
        ])
    if params.get("ridge_cca", None) is not None:
        cargs.extend([
            "-e",
            str(params.get("ridge_cca", None))
        ])
    if params.get("partial_scca_option", None) is not None:
        cargs.extend([
            "--partial-scca-option",
            params.get("partial_scca_option", None)
        ])
    if params.get("timeseriesimage_to_matrix", None) is not None:
        cargs.extend([
            "--timeseriesimage-to-matrix",
            *time_sccan_timeseriesimage_to_matrix_cargs(params.get("timeseriesimage_to_matrix", None), execution)
        ])
    if params.get("labelsimage_to_matrix", None) is not None:
        cargs.extend([
            "--labelsimage-to-matrix",
            execution.input_file(params.get("labelsimage_to_matrix", None))
        ])
    if params.get("network", None) is not None:
        cargs.extend([
            "--network",
            *time_sccan_network_cargs_dyn_fn(params.get("network", None)["@type"])(params.get("network", None), execution)
        ])
    return cargs


def time_sccan_outputs(
    params: TimeSccanParamsDict,
    execution: Execution,
) -> TimeSccanOutputs:
    """
    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 = TimeSccanOutputs(
        root=execution.output_file("."),
        correlation_matrix=execution.output_file(params.get("output", None)),
    )
    return ret


def time_sccan_execute(
    params: TimeSccanParamsDict,
    runner: Runner | None = None,
) -> TimeSccanOutputs:
    """
    TimeSCCAN
    
    A tool for sparse statistical analysis on connectivity within a subject.
    
    Author: ANTs Developers
    
    URL: https://github.com/ANTsX/ANTs
    
    Args:
        params: The parameters.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `TimeSccanOutputs`).
    """
    time_sccan_validate(params)
    runner = runner or get_global_runner()
    execution = runner.start_execution(TIME_SCCAN_METADATA)
    params = execution.params(params)
    cargs = time_sccan_cargs(params, execution)
    ret = time_sccan_outputs(params, execution)
    execution.run(cargs)
    return ret


def time_sccan(
    output: str,
    number_consecutive_labels: int | None = None,
    minimum_region_size: int | None = None,
    iterations: int | None = None,
    sparsity: float | None = None,
    n_eigenvectors: int | None = None,
    robustify: int | None = None,
    l1: float | None = None,
    cluster_thresh: int | None = None,
    ridge_cca: int | None = None,
    partial_scca_option: typing.Literal["PQ", "PminusRQ", "PQminusR", "PminusRQminusR"] | None = None,
    timeseriesimage_to_matrix: TimeSccanTimeseriesimageToMatrixParamsDict | None = None,
    labelsimage_to_matrix: InputPathType | None = None,
    network: typing.Union[TimeSccanNetworkSccaParamsDictTagged, TimeSccanNetworkRegionAveragingParamsDictTagged] | None = None,
    runner: Runner | None = None,
) -> TimeSccanOutputs:
    """
    TimeSCCAN
    
    A tool for sparse statistical analysis on connectivity within a subject.
    
    Author: ANTs Developers
    
    URL: https://github.com/ANTsX/ANTs
    
    Args:
        output: Output is a 2D correlation matrix.
        number_consecutive_labels: Number of consecutive labels in data.
        minimum_region_size: Minimum size of a region: regions below this size\
            are given a 0.0 connectivity value.
        iterations: Number of iterations.
        sparsity: Sparsity - a float from (0,1] indicating what fraction of the\
            data to use.
        n_eigenvectors: Number of permutations to use in scca.
        robustify: Rank-based scca.
        l1: Use l1 ( > 0 ) or l0 ( < 0 ) penalty, also sets gradient step size\
            e.g. -l 0.5 ( L1 ) , -l -0.5 (L0) will set 0.5 grad descent step for\
            either penalty.
        cluster_thresh: Cluster threshold on view P.
        ridge_cca: Number of permutations to use in scca.
        partial_scca_option: Choices for partial SCCA: PQ, PminusRQ, PQminusR,\
            PminusRQminusR.
        timeseriesimage_to_matrix: Takes a timeseries (4D) image and converts\
            it to a 2D matrix csv format as output. If the mask has multiple labels\
            (more than one), then the average time series in each label will be\
            computed and put in the csv.
        labelsimage_to_matrix: Takes a labeled (3D) image and converts it to a\
            2D matrix csv format as output.
        network: Build the network connectivity matrix.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `TimeSccanOutputs`).
    """
    params = time_sccan_params(
        output=output,
        number_consecutive_labels=number_consecutive_labels,
        minimum_region_size=minimum_region_size,
        iterations=iterations,
        sparsity=sparsity,
        n_eigenvectors=n_eigenvectors,
        robustify=robustify,
        l1=l1,
        cluster_thresh=cluster_thresh,
        ridge_cca=ridge_cca,
        partial_scca_option=partial_scca_option,
        timeseriesimage_to_matrix=timeseriesimage_to_matrix,
        labelsimage_to_matrix=labelsimage_to_matrix,
        network=network,
    )
    return time_sccan_execute(params, runner)


__all__ = [
    "TIME_SCCAN_METADATA",
    "TimeSccanNetworkRegionAveragingParamsDict",
    "TimeSccanNetworkRegionAveragingParamsDictTagged",
    "TimeSccanNetworkSccaParamsDict",
    "TimeSccanNetworkSccaParamsDictTagged",
    "TimeSccanOutputs",
    "TimeSccanParamsDict",
    "TimeSccanParamsDictTagged",
    "TimeSccanTimeseriesimageToMatrixParamsDict",
    "TimeSccanTimeseriesimageToMatrixParamsDictTagged",
    "time_sccan",
    "time_sccan_execute",
    "time_sccan_network_region_averaging",
    "time_sccan_network_scca",
    "time_sccan_params",
    "time_sccan_timeseriesimage_to_matrix",
]
