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

import typing
import pathlib
from styxdefs import *

TCK2CONNECTOME_METADATA = Metadata(
    id="a66d5312bce1284177c4cf9ad60b3718c4a1a2b0.boutiques",
    name="tck2connectome",
    package="mrtrix",
    container_image_tag="mrtrix3/mrtrix3:3.0.4",
)


_Tck2connectomeConfigParamsDictNoTag = typing.TypedDict('_Tck2connectomeConfigParamsDictNoTag', {
    "key": str,
    "value": str,
})
Tck2connectomeConfigParamsDictTagged = typing.TypedDict('Tck2connectomeConfigParamsDictTagged', {
    "@type": typing.Literal["config"],
    "key": str,
    "value": str,
})
Tck2connectomeConfigParamsDict = _Tck2connectomeConfigParamsDictNoTag | Tck2connectomeConfigParamsDictTagged


_Tck2connectomeParamsDictNoTag = typing.TypedDict('_Tck2connectomeParamsDictNoTag', {
    "assignment_end_voxels": bool,
    "assignment_radial_search": typing.NotRequired[float | None],
    "assignment_reverse_search": typing.NotRequired[float | None],
    "assignment_forward_search": typing.NotRequired[float | None],
    "assignment_all_voxels": bool,
    "scale_length": bool,
    "scale_invlength": bool,
    "scale_invnodevol": bool,
    "scale_file": typing.NotRequired[InputPathType | None],
    "symmetric": bool,
    "zero_diagonal": bool,
    "stat_edge": typing.NotRequired[str | None],
    "tck_weights_in": typing.NotRequired[InputPathType | None],
    "keep_unassigned": bool,
    "out_assignments": typing.NotRequired[str | None],
    "vector": bool,
    "info": bool,
    "quiet": bool,
    "debug": bool,
    "force": bool,
    "nthreads": typing.NotRequired[int | None],
    "config": typing.NotRequired[list[Tck2connectomeConfigParamsDict] | None],
    "help": bool,
    "version": bool,
    "tracks_in": InputPathType,
    "nodes_in": InputPathType,
    "connectome_out": str,
})
Tck2connectomeParamsDictTagged = typing.TypedDict('Tck2connectomeParamsDictTagged', {
    "@type": typing.Literal["mrtrix/tck2connectome"],
    "assignment_end_voxels": bool,
    "assignment_radial_search": typing.NotRequired[float | None],
    "assignment_reverse_search": typing.NotRequired[float | None],
    "assignment_forward_search": typing.NotRequired[float | None],
    "assignment_all_voxels": bool,
    "scale_length": bool,
    "scale_invlength": bool,
    "scale_invnodevol": bool,
    "scale_file": typing.NotRequired[InputPathType | None],
    "symmetric": bool,
    "zero_diagonal": bool,
    "stat_edge": typing.NotRequired[str | None],
    "tck_weights_in": typing.NotRequired[InputPathType | None],
    "keep_unassigned": bool,
    "out_assignments": typing.NotRequired[str | None],
    "vector": bool,
    "info": bool,
    "quiet": bool,
    "debug": bool,
    "force": bool,
    "nthreads": typing.NotRequired[int | None],
    "config": typing.NotRequired[list[Tck2connectomeConfigParamsDict] | None],
    "help": bool,
    "version": bool,
    "tracks_in": InputPathType,
    "nodes_in": InputPathType,
    "connectome_out": str,
})
Tck2connectomeParamsDict = _Tck2connectomeParamsDictNoTag | Tck2connectomeParamsDictTagged


def tck2connectome_config(
    key: str,
    value: str,
) -> Tck2connectomeConfigParamsDictTagged:
    """
    Build parameters.
    
    Args:
        key: temporarily set the value of an MRtrix config file entry.
        value: temporarily set the value of an MRtrix config file entry.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "config",
        "key": key,
        "value": value,
    }
    return params


def tck2connectome_config_validate(
    params: typing.Any,
) -> None:
    """
    Validate parameters. Throws an error if `params` is not a valid
    `Tck2connectomeConfigParamsDict` 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("key", None) is None:
        raise StyxValidationError("`key` must not be None")
    if not isinstance(params["key"], str):
        raise StyxValidationError(f'`key` has the wrong type: Received `{type(params.get("key", None))}` expected `str`')
    if params.get("value", None) is None:
        raise StyxValidationError("`value` must not be None")
    if not isinstance(params["value"], str):
        raise StyxValidationError(f'`value` has the wrong type: Received `{type(params.get("value", None))}` expected `str`')


def tck2connectome_config_cargs(
    params: Tck2connectomeConfigParamsDict,
    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("-config")
    cargs.append(params.get("key", None))
    cargs.append(params.get("value", None))
    return cargs


class Tck2connectomeOutputs(typing.NamedTuple):
    """
    Output object returned when calling `Tck2connectomeParamsDict(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    connectome_out: OutputPathType
    """the output .csv file containing edge weights"""
    out_assignments: OutputPathType | None
    """output the node assignments of each streamline to a file; this can be
    used subsequently e.g. by the command connectome2tck """


def tck2connectome_params(
    tracks_in: InputPathType,
    nodes_in: InputPathType,
    connectome_out: str,
    assignment_end_voxels: bool = False,
    assignment_radial_search: float | None = None,
    assignment_reverse_search: float | None = None,
    assignment_forward_search: float | None = None,
    assignment_all_voxels: bool = False,
    scale_length: bool = False,
    scale_invlength: bool = False,
    scale_invnodevol: bool = False,
    scale_file: InputPathType | None = None,
    symmetric: bool = False,
    zero_diagonal: bool = False,
    stat_edge: str | None = None,
    tck_weights_in: InputPathType | None = None,
    keep_unassigned: bool = False,
    out_assignments: str | None = None,
    vector: bool = False,
    info: bool = False,
    quiet: bool = False,
    debug: bool = False,
    force: bool = False,
    nthreads: int | None = None,
    config: list[Tck2connectomeConfigParamsDict] | None = None,
    help_: bool = False,
    version: bool = False,
) -> Tck2connectomeParamsDictTagged:
    """
    Build parameters.
    
    Args:
        tracks_in: the input track file.
        nodes_in: the input node parcellation image.
        connectome_out: the output .csv file containing edge weights.
        assignment_end_voxels: use a simple voxel lookup value at each\
            streamline endpoint.
        assignment_radial_search: perform a radial search from each streamline\
            endpoint to locate the nearest node. Argument is the maximum radius in\
            mm; if no node is found within this radius, the streamline endpoint is\
            not assigned to any node. Default search distance is 4mm.
        assignment_reverse_search: traverse from each streamline endpoint\
            inwards along the streamline, in search of the last node traversed by\
            the streamline. Argument is the maximum traversal length in mm (set to\
            0 to allow search to continue to the streamline midpoint).
        assignment_forward_search: project the streamline forwards from the\
            endpoint in search of a parcellation node voxel. Argument is the\
            maximum traversal length in mm.
        assignment_all_voxels: assign the streamline to all nodes it intersects\
            along its length (note that this means a streamline may be assigned to\
            more than two nodes, or indeed none at all).
        scale_length: scale each contribution to the connectome edge by the\
            length of the streamline.
        scale_invlength: scale each contribution to the connectome edge by the\
            inverse of the streamline length.
        scale_invnodevol: scale each contribution to the connectome edge by the\
            inverse of the two node volumes.
        scale_file: scale each contribution to the connectome edge according to\
            the values in a vector file.
        symmetric: Make matrices symmetric on output.
        zero_diagonal: Set matrix diagonal to zero on output.
        stat_edge: statistic for combining the values from all streamlines in\
            an edge into a single scale value for that edge (options are:\
            sum,mean,min,max; default=sum).
        tck_weights_in: specify a text scalar file containing the streamline\
            weights.
        keep_unassigned: By default, the program discards the information\
            regarding those streamlines that are not successfully assigned to a\
            node pair. Set this option to keep these values (will be the first\
            row/column in the output matrix).
        out_assignments: output the node assignments of each streamline to a\
            file; this can be used subsequently e.g. by the command connectome2tck.
        vector: output a vector representing connectivities from a given seed\
            point to target nodes, rather than a matrix of node-node connectivities.
        info: display information messages.
        quiet: do not display information messages or progress status;\
            alternatively, this can be achieved by setting the MRTRIX_QUIET\
            environment variable to a non-empty string.
        debug: display debugging messages.
        force: force overwrite of output files (caution: using the same file as\
            input and output might cause unexpected behaviour).
        nthreads: use this number of threads in multi-threaded applications\
            (set to 0 to disable multi-threading).
        config: temporarily set the value of an MRtrix config file entry.
        help_: display this information page and exit.
        version: display version information and exit.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "mrtrix/tck2connectome",
        "assignment_end_voxels": assignment_end_voxels,
        "assignment_all_voxels": assignment_all_voxels,
        "scale_length": scale_length,
        "scale_invlength": scale_invlength,
        "scale_invnodevol": scale_invnodevol,
        "symmetric": symmetric,
        "zero_diagonal": zero_diagonal,
        "keep_unassigned": keep_unassigned,
        "vector": vector,
        "info": info,
        "quiet": quiet,
        "debug": debug,
        "force": force,
        "help": help_,
        "version": version,
        "tracks_in": tracks_in,
        "nodes_in": nodes_in,
        "connectome_out": connectome_out,
    }
    if assignment_radial_search is not None:
        params["assignment_radial_search"] = assignment_radial_search
    if assignment_reverse_search is not None:
        params["assignment_reverse_search"] = assignment_reverse_search
    if assignment_forward_search is not None:
        params["assignment_forward_search"] = assignment_forward_search
    if scale_file is not None:
        params["scale_file"] = scale_file
    if stat_edge is not None:
        params["stat_edge"] = stat_edge
    if tck_weights_in is not None:
        params["tck_weights_in"] = tck_weights_in
    if out_assignments is not None:
        params["out_assignments"] = out_assignments
    if nthreads is not None:
        params["nthreads"] = nthreads
    if config is not None:
        params["config"] = config
    return params


def tck2connectome_validate(
    params: typing.Any,
) -> None:
    """
    Validate parameters. Throws an error if `params` is not a valid
    `Tck2connectomeParamsDict` 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("assignment_end_voxels", False) is None:
        raise StyxValidationError("`assignment_end_voxels` must not be None")
    if not isinstance(params["assignment_end_voxels"], bool):
        raise StyxValidationError(f'`assignment_end_voxels` has the wrong type: Received `{type(params.get("assignment_end_voxels", False))}` expected `bool`')
    if params.get("assignment_radial_search", None) is not None:
        if not isinstance(params["assignment_radial_search"], (float, int)):
            raise StyxValidationError(f'`assignment_radial_search` has the wrong type: Received `{type(params.get("assignment_radial_search", None))}` expected `float | None`')
    if params.get("assignment_reverse_search", None) is not None:
        if not isinstance(params["assignment_reverse_search"], (float, int)):
            raise StyxValidationError(f'`assignment_reverse_search` has the wrong type: Received `{type(params.get("assignment_reverse_search", None))}` expected `float | None`')
    if params.get("assignment_forward_search", None) is not None:
        if not isinstance(params["assignment_forward_search"], (float, int)):
            raise StyxValidationError(f'`assignment_forward_search` has the wrong type: Received `{type(params.get("assignment_forward_search", None))}` expected `float | None`')
    if params.get("assignment_all_voxels", False) is None:
        raise StyxValidationError("`assignment_all_voxels` must not be None")
    if not isinstance(params["assignment_all_voxels"], bool):
        raise StyxValidationError(f'`assignment_all_voxels` has the wrong type: Received `{type(params.get("assignment_all_voxels", False))}` expected `bool`')
    if params.get("scale_length", False) is None:
        raise StyxValidationError("`scale_length` must not be None")
    if not isinstance(params["scale_length"], bool):
        raise StyxValidationError(f'`scale_length` has the wrong type: Received `{type(params.get("scale_length", False))}` expected `bool`')
    if params.get("scale_invlength", False) is None:
        raise StyxValidationError("`scale_invlength` must not be None")
    if not isinstance(params["scale_invlength"], bool):
        raise StyxValidationError(f'`scale_invlength` has the wrong type: Received `{type(params.get("scale_invlength", False))}` expected `bool`')
    if params.get("scale_invnodevol", False) is None:
        raise StyxValidationError("`scale_invnodevol` must not be None")
    if not isinstance(params["scale_invnodevol"], bool):
        raise StyxValidationError(f'`scale_invnodevol` has the wrong type: Received `{type(params.get("scale_invnodevol", False))}` expected `bool`')
    if params.get("scale_file", None) is not None:
        if not isinstance(params["scale_file"], (pathlib.Path, str)):
            raise StyxValidationError(f'`scale_file` has the wrong type: Received `{type(params.get("scale_file", None))}` expected `InputPathType | None`')
    if params.get("symmetric", False) is None:
        raise StyxValidationError("`symmetric` must not be None")
    if not isinstance(params["symmetric"], bool):
        raise StyxValidationError(f'`symmetric` has the wrong type: Received `{type(params.get("symmetric", False))}` expected `bool`')
    if params.get("zero_diagonal", False) is None:
        raise StyxValidationError("`zero_diagonal` must not be None")
    if not isinstance(params["zero_diagonal"], bool):
        raise StyxValidationError(f'`zero_diagonal` has the wrong type: Received `{type(params.get("zero_diagonal", False))}` expected `bool`')
    if params.get("stat_edge", None) is not None:
        if not isinstance(params["stat_edge"], str):
            raise StyxValidationError(f'`stat_edge` has the wrong type: Received `{type(params.get("stat_edge", None))}` expected `str | None`')
    if params.get("tck_weights_in", None) is not None:
        if not isinstance(params["tck_weights_in"], (pathlib.Path, str)):
            raise StyxValidationError(f'`tck_weights_in` has the wrong type: Received `{type(params.get("tck_weights_in", None))}` expected `InputPathType | None`')
    if params.get("keep_unassigned", False) is None:
        raise StyxValidationError("`keep_unassigned` must not be None")
    if not isinstance(params["keep_unassigned"], bool):
        raise StyxValidationError(f'`keep_unassigned` has the wrong type: Received `{type(params.get("keep_unassigned", False))}` expected `bool`')
    if params.get("out_assignments", None) is not None:
        if not isinstance(params["out_assignments"], str):
            raise StyxValidationError(f'`out_assignments` has the wrong type: Received `{type(params.get("out_assignments", None))}` expected `str | None`')
    if params.get("vector", False) is None:
        raise StyxValidationError("`vector` must not be None")
    if not isinstance(params["vector"], bool):
        raise StyxValidationError(f'`vector` has the wrong type: Received `{type(params.get("vector", False))}` expected `bool`')
    if params.get("info", False) is None:
        raise StyxValidationError("`info` must not be None")
    if not isinstance(params["info"], bool):
        raise StyxValidationError(f'`info` has the wrong type: Received `{type(params.get("info", False))}` expected `bool`')
    if params.get("quiet", False) is None:
        raise StyxValidationError("`quiet` must not be None")
    if not isinstance(params["quiet"], bool):
        raise StyxValidationError(f'`quiet` has the wrong type: Received `{type(params.get("quiet", False))}` expected `bool`')
    if params.get("debug", False) is None:
        raise StyxValidationError("`debug` must not be None")
    if not isinstance(params["debug"], bool):
        raise StyxValidationError(f'`debug` has the wrong type: Received `{type(params.get("debug", False))}` expected `bool`')
    if params.get("force", False) is None:
        raise StyxValidationError("`force` must not be None")
    if not isinstance(params["force"], bool):
        raise StyxValidationError(f'`force` has the wrong type: Received `{type(params.get("force", False))}` expected `bool`')
    if params.get("nthreads", None) is not None:
        if not isinstance(params["nthreads"], int):
            raise StyxValidationError(f'`nthreads` has the wrong type: Received `{type(params.get("nthreads", None))}` expected `int | None`')
    if params.get("config", None) is not None:
        if not isinstance(params["config"], list):
            raise StyxValidationError(f'`config` has the wrong type: Received `{type(params.get("config", None))}` expected `list[Tck2connectomeConfigParamsDict] | None`')
        for e in params["config"]:
            tck2connectome_config_validate(e)
    if params.get("help", False) is None:
        raise StyxValidationError("`help` must not be None")
    if not isinstance(params["help"], bool):
        raise StyxValidationError(f'`help` has the wrong type: Received `{type(params.get("help", False))}` expected `bool`')
    if params.get("version", False) is None:
        raise StyxValidationError("`version` must not be None")
    if not isinstance(params["version"], bool):
        raise StyxValidationError(f'`version` has the wrong type: Received `{type(params.get("version", False))}` expected `bool`')
    if params.get("tracks_in", None) is None:
        raise StyxValidationError("`tracks_in` must not be None")
    if not isinstance(params["tracks_in"], (pathlib.Path, str)):
        raise StyxValidationError(f'`tracks_in` has the wrong type: Received `{type(params.get("tracks_in", None))}` expected `InputPathType`')
    if params.get("nodes_in", None) is None:
        raise StyxValidationError("`nodes_in` must not be None")
    if not isinstance(params["nodes_in"], (pathlib.Path, str)):
        raise StyxValidationError(f'`nodes_in` has the wrong type: Received `{type(params.get("nodes_in", None))}` expected `InputPathType`')
    if params.get("connectome_out", None) is None:
        raise StyxValidationError("`connectome_out` must not be None")
    if not isinstance(params["connectome_out"], str):
        raise StyxValidationError(f'`connectome_out` has the wrong type: Received `{type(params.get("connectome_out", None))}` expected `str`')


def tck2connectome_cargs(
    params: Tck2connectomeParamsDict,
    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("tck2connectome")
    if params.get("assignment_end_voxels", False):
        cargs.append("-assignment_end_voxels")
    if params.get("assignment_radial_search", None) is not None:
        cargs.extend([
            "-assignment_radial_search",
            str(params.get("assignment_radial_search", None))
        ])
    if params.get("assignment_reverse_search", None) is not None:
        cargs.extend([
            "-assignment_reverse_search",
            str(params.get("assignment_reverse_search", None))
        ])
    if params.get("assignment_forward_search", None) is not None:
        cargs.extend([
            "-assignment_forward_search",
            str(params.get("assignment_forward_search", None))
        ])
    if params.get("assignment_all_voxels", False):
        cargs.append("-assignment_all_voxels")
    if params.get("scale_length", False):
        cargs.append("-scale_length")
    if params.get("scale_invlength", False):
        cargs.append("-scale_invlength")
    if params.get("scale_invnodevol", False):
        cargs.append("-scale_invnodevol")
    if params.get("scale_file", None) is not None:
        cargs.extend([
            "-scale_file",
            execution.input_file(params.get("scale_file", None))
        ])
    if params.get("symmetric", False):
        cargs.append("-symmetric")
    if params.get("zero_diagonal", False):
        cargs.append("-zero_diagonal")
    if params.get("stat_edge", None) is not None:
        cargs.extend([
            "-stat_edge",
            params.get("stat_edge", None)
        ])
    if params.get("tck_weights_in", None) is not None:
        cargs.extend([
            "-tck_weights_in",
            execution.input_file(params.get("tck_weights_in", None))
        ])
    if params.get("keep_unassigned", False):
        cargs.append("-keep_unassigned")
    if params.get("out_assignments", None) is not None:
        cargs.extend([
            "-out_assignments",
            params.get("out_assignments", None)
        ])
    if params.get("vector", False):
        cargs.append("-vector")
    if params.get("info", False):
        cargs.append("-info")
    if params.get("quiet", False):
        cargs.append("-quiet")
    if params.get("debug", False):
        cargs.append("-debug")
    if params.get("force", False):
        cargs.append("-force")
    if params.get("nthreads", None) is not None:
        cargs.extend([
            "-nthreads",
            str(params.get("nthreads", None))
        ])
    if params.get("config", None) is not None:
        cargs.extend([a for c in [tck2connectome_config_cargs(s, execution) for s in params.get("config", None)] for a in c])
    if params.get("help", False):
        cargs.append("-help")
    if params.get("version", False):
        cargs.append("-version")
    cargs.append(execution.input_file(params.get("tracks_in", None)))
    cargs.append(execution.input_file(params.get("nodes_in", None)))
    cargs.append(params.get("connectome_out", None))
    return cargs


def tck2connectome_outputs(
    params: Tck2connectomeParamsDict,
    execution: Execution,
) -> Tck2connectomeOutputs:
    """
    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 = Tck2connectomeOutputs(
        root=execution.output_file("."),
        connectome_out=execution.output_file(params.get("connectome_out", None)),
        out_assignments=execution.output_file(params.get("out_assignments", None)) if (params.get("out_assignments") is not None) else None,
    )
    return ret


def tck2connectome_execute(
    params: Tck2connectomeParamsDict,
    runner: Runner | None = None,
) -> Tck2connectomeOutputs:
    """
    tck2connectome
    
    Generate a connectome matrix from a streamlines file and a node parcellation
    image.
    
    
    
    References:
    
    If using the default streamline-parcel assignment mechanism (or
    -assignment_radial_search option): Smith, R. E.; Tournier, J.-D.; Calamante,
    F. & Connelly, A. The effects of SIFT on the reproducibility and biological
    accuracy of the structural connectome. NeuroImage, 2015, 104, 253-265
    
    If using -scale_invlength or -scale_invnodevol options: Hagmann, P.;
    Cammoun, L.; Gigandet, X.; Meuli, R.; Honey, C.; Wedeen, V. & Sporns, O.
    Mapping the Structural Core of Human Cerebral Cortex. PLoS Biology 6(7),
    e159.
    
    Author: MRTrix3 Developers
    
    URL: https://www.mrtrix.org/
    
    Args:
        params: The parameters.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `Tck2connectomeOutputs`).
    """
    tck2connectome_validate(params)
    runner = runner or get_global_runner()
    execution = runner.start_execution(TCK2CONNECTOME_METADATA)
    params = execution.params(params)
    cargs = tck2connectome_cargs(params, execution)
    ret = tck2connectome_outputs(params, execution)
    execution.run(cargs)
    return ret


def tck2connectome(
    tracks_in: InputPathType,
    nodes_in: InputPathType,
    connectome_out: str,
    assignment_end_voxels: bool = False,
    assignment_radial_search: float | None = None,
    assignment_reverse_search: float | None = None,
    assignment_forward_search: float | None = None,
    assignment_all_voxels: bool = False,
    scale_length: bool = False,
    scale_invlength: bool = False,
    scale_invnodevol: bool = False,
    scale_file: InputPathType | None = None,
    symmetric: bool = False,
    zero_diagonal: bool = False,
    stat_edge: str | None = None,
    tck_weights_in: InputPathType | None = None,
    keep_unassigned: bool = False,
    out_assignments: str | None = None,
    vector: bool = False,
    info: bool = False,
    quiet: bool = False,
    debug: bool = False,
    force: bool = False,
    nthreads: int | None = None,
    config: list[Tck2connectomeConfigParamsDict] | None = None,
    help_: bool = False,
    version: bool = False,
    runner: Runner | None = None,
) -> Tck2connectomeOutputs:
    """
    tck2connectome
    
    Generate a connectome matrix from a streamlines file and a node parcellation
    image.
    
    
    
    References:
    
    If using the default streamline-parcel assignment mechanism (or
    -assignment_radial_search option): Smith, R. E.; Tournier, J.-D.; Calamante,
    F. & Connelly, A. The effects of SIFT on the reproducibility and biological
    accuracy of the structural connectome. NeuroImage, 2015, 104, 253-265
    
    If using -scale_invlength or -scale_invnodevol options: Hagmann, P.;
    Cammoun, L.; Gigandet, X.; Meuli, R.; Honey, C.; Wedeen, V. & Sporns, O.
    Mapping the Structural Core of Human Cerebral Cortex. PLoS Biology 6(7),
    e159.
    
    Author: MRTrix3 Developers
    
    URL: https://www.mrtrix.org/
    
    Args:
        tracks_in: the input track file.
        nodes_in: the input node parcellation image.
        connectome_out: the output .csv file containing edge weights.
        assignment_end_voxels: use a simple voxel lookup value at each\
            streamline endpoint.
        assignment_radial_search: perform a radial search from each streamline\
            endpoint to locate the nearest node. Argument is the maximum radius in\
            mm; if no node is found within this radius, the streamline endpoint is\
            not assigned to any node. Default search distance is 4mm.
        assignment_reverse_search: traverse from each streamline endpoint\
            inwards along the streamline, in search of the last node traversed by\
            the streamline. Argument is the maximum traversal length in mm (set to\
            0 to allow search to continue to the streamline midpoint).
        assignment_forward_search: project the streamline forwards from the\
            endpoint in search of a parcellation node voxel. Argument is the\
            maximum traversal length in mm.
        assignment_all_voxels: assign the streamline to all nodes it intersects\
            along its length (note that this means a streamline may be assigned to\
            more than two nodes, or indeed none at all).
        scale_length: scale each contribution to the connectome edge by the\
            length of the streamline.
        scale_invlength: scale each contribution to the connectome edge by the\
            inverse of the streamline length.
        scale_invnodevol: scale each contribution to the connectome edge by the\
            inverse of the two node volumes.
        scale_file: scale each contribution to the connectome edge according to\
            the values in a vector file.
        symmetric: Make matrices symmetric on output.
        zero_diagonal: Set matrix diagonal to zero on output.
        stat_edge: statistic for combining the values from all streamlines in\
            an edge into a single scale value for that edge (options are:\
            sum,mean,min,max; default=sum).
        tck_weights_in: specify a text scalar file containing the streamline\
            weights.
        keep_unassigned: By default, the program discards the information\
            regarding those streamlines that are not successfully assigned to a\
            node pair. Set this option to keep these values (will be the first\
            row/column in the output matrix).
        out_assignments: output the node assignments of each streamline to a\
            file; this can be used subsequently e.g. by the command connectome2tck.
        vector: output a vector representing connectivities from a given seed\
            point to target nodes, rather than a matrix of node-node connectivities.
        info: display information messages.
        quiet: do not display information messages or progress status;\
            alternatively, this can be achieved by setting the MRTRIX_QUIET\
            environment variable to a non-empty string.
        debug: display debugging messages.
        force: force overwrite of output files (caution: using the same file as\
            input and output might cause unexpected behaviour).
        nthreads: use this number of threads in multi-threaded applications\
            (set to 0 to disable multi-threading).
        config: temporarily set the value of an MRtrix config file entry.
        help_: display this information page and exit.
        version: display version information and exit.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `Tck2connectomeOutputs`).
    """
    params = tck2connectome_params(
        assignment_end_voxels=assignment_end_voxels,
        assignment_radial_search=assignment_radial_search,
        assignment_reverse_search=assignment_reverse_search,
        assignment_forward_search=assignment_forward_search,
        assignment_all_voxels=assignment_all_voxels,
        scale_length=scale_length,
        scale_invlength=scale_invlength,
        scale_invnodevol=scale_invnodevol,
        scale_file=scale_file,
        symmetric=symmetric,
        zero_diagonal=zero_diagonal,
        stat_edge=stat_edge,
        tck_weights_in=tck_weights_in,
        keep_unassigned=keep_unassigned,
        out_assignments=out_assignments,
        vector=vector,
        info=info,
        quiet=quiet,
        debug=debug,
        force=force,
        nthreads=nthreads,
        config=config,
        help_=help_,
        version=version,
        tracks_in=tracks_in,
        nodes_in=nodes_in,
        connectome_out=connectome_out,
    )
    return tck2connectome_execute(params, runner)


__all__ = [
    "TCK2CONNECTOME_METADATA",
    "Tck2connectomeConfigParamsDict",
    "Tck2connectomeConfigParamsDictTagged",
    "Tck2connectomeOutputs",
    "Tck2connectomeParamsDict",
    "Tck2connectomeParamsDictTagged",
    "tck2connectome",
    "tck2connectome_config",
    "tck2connectome_execute",
    "tck2connectome_params",
]
