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

import typing
import pathlib
from styxdefs import *

TCKSIFT_METADATA = Metadata(
    id="7ab67267156023e9057e22433c919ff074901975.boutiques",
    name="tcksift",
    package="mrtrix",
    container_image_tag="mrtrix3/mrtrix3:3.0.4",
)


_TcksiftConfigParamsDictNoTag = typing.TypedDict('_TcksiftConfigParamsDictNoTag', {
    "key": str,
    "value": str,
})
TcksiftConfigParamsDictTagged = typing.TypedDict('TcksiftConfigParamsDictTagged', {
    "@type": typing.Literal["config"],
    "key": str,
    "value": str,
})
TcksiftConfigParamsDict = _TcksiftConfigParamsDictNoTag | TcksiftConfigParamsDictTagged


_TcksiftParamsDictNoTag = typing.TypedDict('_TcksiftParamsDictNoTag', {
    "nofilter": bool,
    "output_at_counts": typing.NotRequired[list[int] | None],
    "proc_mask": typing.NotRequired[InputPathType | None],
    "act": typing.NotRequired[InputPathType | None],
    "fd_scale_gm": bool,
    "no_dilate_lut": bool,
    "make_null_lobes": bool,
    "remove_untracked": bool,
    "fd_thresh": typing.NotRequired[float | None],
    "csv": typing.NotRequired[str | None],
    "out_mu": typing.NotRequired[str | None],
    "output_debug": bool,
    "out_selection": typing.NotRequired[str | None],
    "term_number": typing.NotRequired[int | None],
    "term_ratio": typing.NotRequired[float | None],
    "term_mu": typing.NotRequired[float | None],
    "info": bool,
    "quiet": bool,
    "debug": bool,
    "force": bool,
    "nthreads": typing.NotRequired[int | None],
    "config": typing.NotRequired[list[TcksiftConfigParamsDict] | None],
    "help": bool,
    "version": bool,
    "in_tracks": InputPathType,
    "in_fod": InputPathType,
    "out_tracks": str,
})
TcksiftParamsDictTagged = typing.TypedDict('TcksiftParamsDictTagged', {
    "@type": typing.Literal["mrtrix/tcksift"],
    "nofilter": bool,
    "output_at_counts": typing.NotRequired[list[int] | None],
    "proc_mask": typing.NotRequired[InputPathType | None],
    "act": typing.NotRequired[InputPathType | None],
    "fd_scale_gm": bool,
    "no_dilate_lut": bool,
    "make_null_lobes": bool,
    "remove_untracked": bool,
    "fd_thresh": typing.NotRequired[float | None],
    "csv": typing.NotRequired[str | None],
    "out_mu": typing.NotRequired[str | None],
    "output_debug": bool,
    "out_selection": typing.NotRequired[str | None],
    "term_number": typing.NotRequired[int | None],
    "term_ratio": typing.NotRequired[float | None],
    "term_mu": typing.NotRequired[float | None],
    "info": bool,
    "quiet": bool,
    "debug": bool,
    "force": bool,
    "nthreads": typing.NotRequired[int | None],
    "config": typing.NotRequired[list[TcksiftConfigParamsDict] | None],
    "help": bool,
    "version": bool,
    "in_tracks": InputPathType,
    "in_fod": InputPathType,
    "out_tracks": str,
})
TcksiftParamsDict = _TcksiftParamsDictNoTag | TcksiftParamsDictTagged


def tcksift_config(
    key: str,
    value: str,
) -> TcksiftConfigParamsDictTagged:
    """
    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 tcksift_config_validate(
    params: typing.Any,
) -> None:
    """
    Validate parameters. Throws an error if `params` is not a valid
    `TcksiftConfigParamsDict` 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 tcksift_config_cargs(
    params: TcksiftConfigParamsDict,
    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 TcksiftOutputs(typing.NamedTuple):
    """
    Output object returned when calling `TcksiftParamsDict(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    out_tracks: OutputPathType
    """the output filtered tracks file"""
    csv_: OutputPathType | None
    """output statistics of execution per iteration to a .csv file """
    out_mu: OutputPathType | None
    """output the final value of SIFT proportionality coefficient mu to a text
    file """
    out_selection: OutputPathType | None
    """output a text file containing the binary selection of streamlines """


def tcksift_params(
    in_tracks: InputPathType,
    in_fod: InputPathType,
    out_tracks: str,
    nofilter: bool = False,
    output_at_counts: list[int] | None = None,
    proc_mask: InputPathType | None = None,
    act: InputPathType | None = None,
    fd_scale_gm: bool = False,
    no_dilate_lut: bool = False,
    make_null_lobes: bool = False,
    remove_untracked: bool = False,
    fd_thresh: float | None = None,
    csv_: str | None = None,
    out_mu: str | None = None,
    output_debug: bool = False,
    out_selection: str | None = None,
    term_number: int | None = None,
    term_ratio: float | None = None,
    term_mu: float | None = None,
    info: bool = False,
    quiet: bool = False,
    debug: bool = False,
    force: bool = False,
    nthreads: int | None = None,
    config: list[TcksiftConfigParamsDict] | None = None,
    help_: bool = False,
    version: bool = False,
) -> TcksiftParamsDictTagged:
    """
    Build parameters.
    
    Args:
        in_tracks: the input track file.
        in_fod: input image containing the spherical harmonics of the fibre\
            orientation distributions.
        out_tracks: the output filtered tracks file.
        nofilter: do NOT perform track filtering - just construct the model in\
            order to provide output debugging images.
        output_at_counts: output filtered track files (and optionally debugging\
            images if -output_debug is specified) at specific numbers of remaining\
            streamlines; provide as comma-separated list of integers.
        proc_mask: provide an image containing the processing mask weights for\
            the model; image spatial dimensions must match the fixel image.
        act: use an ACT five-tissue-type segmented anatomical image to derive\
            the processing mask.
        fd_scale_gm: provide this option (in conjunction with -act) to\
            heuristically downsize the fibre density estimates based on the\
            presence of GM in the voxel. This can assist in reducing tissue\
            interface effects when using a single-tissue deconvolution algorithm.
        no_dilate_lut: do NOT dilate FOD lobe lookup tables; only map\
            streamlines to FOD lobes if the precise tangent lies within the angular\
            spread of that lobe.
        make_null_lobes: add an additional FOD lobe to each voxel, with zero\
            integral, that covers all directions with zero / negative FOD\
            amplitudes.
        remove_untracked: remove FOD lobes that do not have any streamline\
            density attributed to them; this improves filtering slightly, at the\
            expense of longer computation time (and you can no longer do\
            quantitative comparisons between reconstructions if this is enabled).
        fd_thresh: fibre density threshold; exclude an FOD lobe from filtering\
            processing if its integral is less than this amount (streamlines will\
            still be mapped to it, but it will not contribute to the cost function\
            or the filtering).
        csv_: output statistics of execution per iteration to a .csv file.
        out_mu: output the final value of SIFT proportionality coefficient mu\
            to a text file.
        output_debug: provide various output images for assessing & debugging\
            performance etc.
        out_selection: output a text file containing the binary selection of\
            streamlines.
        term_number: number of streamlines - continue filtering until this\
            number of streamlines remain.
        term_ratio: termination ratio - defined as the ratio between reduction\
            in cost function, and reduction in density of streamlines.\
            Smaller values result in more streamlines being filtered out.
        term_mu: terminate filtering once the SIFT proportionality coefficient\
            reaches a given value.
        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/tcksift",
        "nofilter": nofilter,
        "fd_scale_gm": fd_scale_gm,
        "no_dilate_lut": no_dilate_lut,
        "make_null_lobes": make_null_lobes,
        "remove_untracked": remove_untracked,
        "output_debug": output_debug,
        "info": info,
        "quiet": quiet,
        "debug": debug,
        "force": force,
        "help": help_,
        "version": version,
        "in_tracks": in_tracks,
        "in_fod": in_fod,
        "out_tracks": out_tracks,
    }
    if output_at_counts is not None:
        params["output_at_counts"] = output_at_counts
    if proc_mask is not None:
        params["proc_mask"] = proc_mask
    if act is not None:
        params["act"] = act
    if fd_thresh is not None:
        params["fd_thresh"] = fd_thresh
    if csv_ is not None:
        params["csv"] = csv_
    if out_mu is not None:
        params["out_mu"] = out_mu
    if out_selection is not None:
        params["out_selection"] = out_selection
    if term_number is not None:
        params["term_number"] = term_number
    if term_ratio is not None:
        params["term_ratio"] = term_ratio
    if term_mu is not None:
        params["term_mu"] = term_mu
    if nthreads is not None:
        params["nthreads"] = nthreads
    if config is not None:
        params["config"] = config
    return params


def tcksift_validate(
    params: typing.Any,
) -> None:
    """
    Validate parameters. Throws an error if `params` is not a valid
    `TcksiftParamsDict` 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("nofilter", False) is None:
        raise StyxValidationError("`nofilter` must not be None")
    if not isinstance(params["nofilter"], bool):
        raise StyxValidationError(f'`nofilter` has the wrong type: Received `{type(params.get("nofilter", False))}` expected `bool`')
    if params.get("output_at_counts", None) is not None:
        if not isinstance(params["output_at_counts"], list):
            raise StyxValidationError(f'`output_at_counts` has the wrong type: Received `{type(params.get("output_at_counts", None))}` expected `list[int] | None`')
        for e in params["output_at_counts"]:
            if not isinstance(e, int):
                raise StyxValidationError(f'`output_at_counts` has the wrong type: Received `{type(params.get("output_at_counts", None))}` expected `list[int] | None`')
    if params.get("proc_mask", None) is not None:
        if not isinstance(params["proc_mask"], (pathlib.Path, str)):
            raise StyxValidationError(f'`proc_mask` has the wrong type: Received `{type(params.get("proc_mask", None))}` expected `InputPathType | None`')
    if params.get("act", None) is not None:
        if not isinstance(params["act"], (pathlib.Path, str)):
            raise StyxValidationError(f'`act` has the wrong type: Received `{type(params.get("act", None))}` expected `InputPathType | None`')
    if params.get("fd_scale_gm", False) is None:
        raise StyxValidationError("`fd_scale_gm` must not be None")
    if not isinstance(params["fd_scale_gm"], bool):
        raise StyxValidationError(f'`fd_scale_gm` has the wrong type: Received `{type(params.get("fd_scale_gm", False))}` expected `bool`')
    if params.get("no_dilate_lut", False) is None:
        raise StyxValidationError("`no_dilate_lut` must not be None")
    if not isinstance(params["no_dilate_lut"], bool):
        raise StyxValidationError(f'`no_dilate_lut` has the wrong type: Received `{type(params.get("no_dilate_lut", False))}` expected `bool`')
    if params.get("make_null_lobes", False) is None:
        raise StyxValidationError("`make_null_lobes` must not be None")
    if not isinstance(params["make_null_lobes"], bool):
        raise StyxValidationError(f'`make_null_lobes` has the wrong type: Received `{type(params.get("make_null_lobes", False))}` expected `bool`')
    if params.get("remove_untracked", False) is None:
        raise StyxValidationError("`remove_untracked` must not be None")
    if not isinstance(params["remove_untracked"], bool):
        raise StyxValidationError(f'`remove_untracked` has the wrong type: Received `{type(params.get("remove_untracked", False))}` expected `bool`')
    if params.get("fd_thresh", None) is not None:
        if not isinstance(params["fd_thresh"], (float, int)):
            raise StyxValidationError(f'`fd_thresh` has the wrong type: Received `{type(params.get("fd_thresh", None))}` expected `float | None`')
    if params.get("csv", None) is not None:
        if not isinstance(params["csv"], str):
            raise StyxValidationError(f'`csv` has the wrong type: Received `{type(params.get("csv", None))}` expected `str | None`')
    if params.get("out_mu", None) is not None:
        if not isinstance(params["out_mu"], str):
            raise StyxValidationError(f'`out_mu` has the wrong type: Received `{type(params.get("out_mu", None))}` expected `str | None`')
    if params.get("output_debug", False) is None:
        raise StyxValidationError("`output_debug` must not be None")
    if not isinstance(params["output_debug"], bool):
        raise StyxValidationError(f'`output_debug` has the wrong type: Received `{type(params.get("output_debug", False))}` expected `bool`')
    if params.get("out_selection", None) is not None:
        if not isinstance(params["out_selection"], str):
            raise StyxValidationError(f'`out_selection` has the wrong type: Received `{type(params.get("out_selection", None))}` expected `str | None`')
    if params.get("term_number", None) is not None:
        if not isinstance(params["term_number"], int):
            raise StyxValidationError(f'`term_number` has the wrong type: Received `{type(params.get("term_number", None))}` expected `int | None`')
    if params.get("term_ratio", None) is not None:
        if not isinstance(params["term_ratio"], (float, int)):
            raise StyxValidationError(f'`term_ratio` has the wrong type: Received `{type(params.get("term_ratio", None))}` expected `float | None`')
    if params.get("term_mu", None) is not None:
        if not isinstance(params["term_mu"], (float, int)):
            raise StyxValidationError(f'`term_mu` has the wrong type: Received `{type(params.get("term_mu", None))}` expected `float | None`')
    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[TcksiftConfigParamsDict] | None`')
        for e in params["config"]:
            tcksift_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("in_tracks", None) is None:
        raise StyxValidationError("`in_tracks` must not be None")
    if not isinstance(params["in_tracks"], (pathlib.Path, str)):
        raise StyxValidationError(f'`in_tracks` has the wrong type: Received `{type(params.get("in_tracks", None))}` expected `InputPathType`')
    if params.get("in_fod", None) is None:
        raise StyxValidationError("`in_fod` must not be None")
    if not isinstance(params["in_fod"], (pathlib.Path, str)):
        raise StyxValidationError(f'`in_fod` has the wrong type: Received `{type(params.get("in_fod", None))}` expected `InputPathType`')
    if params.get("out_tracks", None) is None:
        raise StyxValidationError("`out_tracks` must not be None")
    if not isinstance(params["out_tracks"], str):
        raise StyxValidationError(f'`out_tracks` has the wrong type: Received `{type(params.get("out_tracks", None))}` expected `str`')


def tcksift_cargs(
    params: TcksiftParamsDict,
    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("tcksift")
    if params.get("nofilter", False):
        cargs.append("-nofilter")
    if params.get("output_at_counts", None) is not None:
        cargs.extend([
            "-output_at_counts",
            ",".join(map(str, params.get("output_at_counts", None)))
        ])
    if params.get("proc_mask", None) is not None:
        cargs.extend([
            "-proc_mask",
            execution.input_file(params.get("proc_mask", None))
        ])
    if params.get("act", None) is not None:
        cargs.extend([
            "-act",
            execution.input_file(params.get("act", None))
        ])
    if params.get("fd_scale_gm", False):
        cargs.append("-fd_scale_gm")
    if params.get("no_dilate_lut", False):
        cargs.append("-no_dilate_lut")
    if params.get("make_null_lobes", False):
        cargs.append("-make_null_lobes")
    if params.get("remove_untracked", False):
        cargs.append("-remove_untracked")
    if params.get("fd_thresh", None) is not None:
        cargs.extend([
            "-fd_thresh",
            str(params.get("fd_thresh", None))
        ])
    if params.get("csv", None) is not None:
        cargs.extend([
            "-csv",
            params.get("csv", None)
        ])
    if params.get("out_mu", None) is not None:
        cargs.extend([
            "-out_mu",
            params.get("out_mu", None)
        ])
    if params.get("output_debug", False):
        cargs.append("-output_debug")
    if params.get("out_selection", None) is not None:
        cargs.extend([
            "-out_selection",
            params.get("out_selection", None)
        ])
    if params.get("term_number", None) is not None:
        cargs.extend([
            "-term_number",
            str(params.get("term_number", None))
        ])
    if params.get("term_ratio", None) is not None:
        cargs.extend([
            "-term_ratio",
            str(params.get("term_ratio", None))
        ])
    if params.get("term_mu", None) is not None:
        cargs.extend([
            "-term_mu",
            str(params.get("term_mu", None))
        ])
    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 [tcksift_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("in_tracks", None)))
    cargs.append(execution.input_file(params.get("in_fod", None)))
    cargs.append(params.get("out_tracks", None))
    return cargs


def tcksift_outputs(
    params: TcksiftParamsDict,
    execution: Execution,
) -> TcksiftOutputs:
    """
    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 = TcksiftOutputs(
        root=execution.output_file("."),
        out_tracks=execution.output_file(params.get("out_tracks", None)),
        csv_=execution.output_file(params.get("csv", None)) if (params.get("csv") is not None) else None,
        out_mu=execution.output_file(params.get("out_mu", None)) if (params.get("out_mu") is not None) else None,
        out_selection=execution.output_file(params.get("out_selection", None)) if (params.get("out_selection") is not None) else None,
    )
    return ret


def tcksift_execute(
    params: TcksiftParamsDict,
    runner: Runner | None = None,
) -> TcksiftOutputs:
    """
    tcksift
    
    Filter a whole-brain fibre-tracking data set such that the streamline
    densities match the FOD lobe integrals.
    
    
    
    References:
    
    Smith, R. E.; Tournier, J.-D.; Calamante, F. & Connelly, A. SIFT:
    Spherical-deconvolution informed filtering of tractograms. NeuroImage, 2013,
    67, 298-312.
    
    Author: MRTrix3 Developers
    
    URL: https://www.mrtrix.org/
    
    Args:
        params: The parameters.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `TcksiftOutputs`).
    """
    tcksift_validate(params)
    runner = runner or get_global_runner()
    execution = runner.start_execution(TCKSIFT_METADATA)
    params = execution.params(params)
    cargs = tcksift_cargs(params, execution)
    ret = tcksift_outputs(params, execution)
    execution.run(cargs)
    return ret


def tcksift(
    in_tracks: InputPathType,
    in_fod: InputPathType,
    out_tracks: str,
    nofilter: bool = False,
    output_at_counts: list[int] | None = None,
    proc_mask: InputPathType | None = None,
    act: InputPathType | None = None,
    fd_scale_gm: bool = False,
    no_dilate_lut: bool = False,
    make_null_lobes: bool = False,
    remove_untracked: bool = False,
    fd_thresh: float | None = None,
    csv_: str | None = None,
    out_mu: str | None = None,
    output_debug: bool = False,
    out_selection: str | None = None,
    term_number: int | None = None,
    term_ratio: float | None = None,
    term_mu: float | None = None,
    info: bool = False,
    quiet: bool = False,
    debug: bool = False,
    force: bool = False,
    nthreads: int | None = None,
    config: list[TcksiftConfigParamsDict] | None = None,
    help_: bool = False,
    version: bool = False,
    runner: Runner | None = None,
) -> TcksiftOutputs:
    """
    tcksift
    
    Filter a whole-brain fibre-tracking data set such that the streamline
    densities match the FOD lobe integrals.
    
    
    
    References:
    
    Smith, R. E.; Tournier, J.-D.; Calamante, F. & Connelly, A. SIFT:
    Spherical-deconvolution informed filtering of tractograms. NeuroImage, 2013,
    67, 298-312.
    
    Author: MRTrix3 Developers
    
    URL: https://www.mrtrix.org/
    
    Args:
        in_tracks: the input track file.
        in_fod: input image containing the spherical harmonics of the fibre\
            orientation distributions.
        out_tracks: the output filtered tracks file.
        nofilter: do NOT perform track filtering - just construct the model in\
            order to provide output debugging images.
        output_at_counts: output filtered track files (and optionally debugging\
            images if -output_debug is specified) at specific numbers of remaining\
            streamlines; provide as comma-separated list of integers.
        proc_mask: provide an image containing the processing mask weights for\
            the model; image spatial dimensions must match the fixel image.
        act: use an ACT five-tissue-type segmented anatomical image to derive\
            the processing mask.
        fd_scale_gm: provide this option (in conjunction with -act) to\
            heuristically downsize the fibre density estimates based on the\
            presence of GM in the voxel. This can assist in reducing tissue\
            interface effects when using a single-tissue deconvolution algorithm.
        no_dilate_lut: do NOT dilate FOD lobe lookup tables; only map\
            streamlines to FOD lobes if the precise tangent lies within the angular\
            spread of that lobe.
        make_null_lobes: add an additional FOD lobe to each voxel, with zero\
            integral, that covers all directions with zero / negative FOD\
            amplitudes.
        remove_untracked: remove FOD lobes that do not have any streamline\
            density attributed to them; this improves filtering slightly, at the\
            expense of longer computation time (and you can no longer do\
            quantitative comparisons between reconstructions if this is enabled).
        fd_thresh: fibre density threshold; exclude an FOD lobe from filtering\
            processing if its integral is less than this amount (streamlines will\
            still be mapped to it, but it will not contribute to the cost function\
            or the filtering).
        csv_: output statistics of execution per iteration to a .csv file.
        out_mu: output the final value of SIFT proportionality coefficient mu\
            to a text file.
        output_debug: provide various output images for assessing & debugging\
            performance etc.
        out_selection: output a text file containing the binary selection of\
            streamlines.
        term_number: number of streamlines - continue filtering until this\
            number of streamlines remain.
        term_ratio: termination ratio - defined as the ratio between reduction\
            in cost function, and reduction in density of streamlines.\
            Smaller values result in more streamlines being filtered out.
        term_mu: terminate filtering once the SIFT proportionality coefficient\
            reaches a given value.
        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 `TcksiftOutputs`).
    """
    params = tcksift_params(
        nofilter=nofilter,
        output_at_counts=output_at_counts,
        proc_mask=proc_mask,
        act=act,
        fd_scale_gm=fd_scale_gm,
        no_dilate_lut=no_dilate_lut,
        make_null_lobes=make_null_lobes,
        remove_untracked=remove_untracked,
        fd_thresh=fd_thresh,
        csv_=csv_,
        out_mu=out_mu,
        output_debug=output_debug,
        out_selection=out_selection,
        term_number=term_number,
        term_ratio=term_ratio,
        term_mu=term_mu,
        info=info,
        quiet=quiet,
        debug=debug,
        force=force,
        nthreads=nthreads,
        config=config,
        help_=help_,
        version=version,
        in_tracks=in_tracks,
        in_fod=in_fod,
        out_tracks=out_tracks,
    )
    return tcksift_execute(params, runner)


__all__ = [
    "TCKSIFT_METADATA",
    "TcksiftConfigParamsDict",
    "TcksiftConfigParamsDictTagged",
    "TcksiftOutputs",
    "TcksiftParamsDict",
    "TcksiftParamsDictTagged",
    "tcksift",
    "tcksift_config",
    "tcksift_execute",
    "tcksift_params",
]
