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

import typing
import pathlib
from styxdefs import *

FIXELFILTER_METADATA = Metadata(
    id="b5e8a361d7de5f948949260328ab5131eb18a9b7.boutiques",
    name="fixelfilter",
    package="mrtrix",
    container_image_tag="mrtrix3/mrtrix3:3.0.4",
)


_FixelfilterConfigParamsDictNoTag = typing.TypedDict('_FixelfilterConfigParamsDictNoTag', {
    "key": str,
    "value": str,
})
FixelfilterConfigParamsDictTagged = typing.TypedDict('FixelfilterConfigParamsDictTagged', {
    "@type": typing.Literal["config"],
    "key": str,
    "value": str,
})
FixelfilterConfigParamsDict = _FixelfilterConfigParamsDictNoTag | FixelfilterConfigParamsDictTagged


_FixelfilterVariousStringParamsDictNoTag = typing.TypedDict('_FixelfilterVariousStringParamsDictNoTag', {
    "obj": str,
})
FixelfilterVariousStringParamsDictTagged = typing.TypedDict('FixelfilterVariousStringParamsDictTagged', {
    "@type": typing.Literal["VariousString"],
    "obj": str,
})
FixelfilterVariousStringParamsDict = _FixelfilterVariousStringParamsDictNoTag | FixelfilterVariousStringParamsDictTagged


_FixelfilterVariousFileParamsDictNoTag = typing.TypedDict('_FixelfilterVariousFileParamsDictNoTag', {
    "obj": InputPathType,
})
FixelfilterVariousFileParamsDictTagged = typing.TypedDict('FixelfilterVariousFileParamsDictTagged', {
    "@type": typing.Literal["VariousFile"],
    "obj": InputPathType,
})
FixelfilterVariousFileParamsDict = _FixelfilterVariousFileParamsDictNoTag | FixelfilterVariousFileParamsDictTagged


_FixelfilterVariousString1ParamsDictNoTag = typing.TypedDict('_FixelfilterVariousString1ParamsDictNoTag', {
    "obj": str,
})
FixelfilterVariousString1ParamsDictTagged = typing.TypedDict('FixelfilterVariousString1ParamsDictTagged', {
    "@type": typing.Literal["VariousString_1"],
    "obj": str,
})
FixelfilterVariousString1ParamsDict = _FixelfilterVariousString1ParamsDictNoTag | FixelfilterVariousString1ParamsDictTagged


_FixelfilterVariousFile1ParamsDictNoTag = typing.TypedDict('_FixelfilterVariousFile1ParamsDictNoTag', {
    "obj": InputPathType,
})
FixelfilterVariousFile1ParamsDictTagged = typing.TypedDict('FixelfilterVariousFile1ParamsDictTagged', {
    "@type": typing.Literal["VariousFile_1"],
    "obj": InputPathType,
})
FixelfilterVariousFile1ParamsDict = _FixelfilterVariousFile1ParamsDictNoTag | FixelfilterVariousFile1ParamsDictTagged


_FixelfilterParamsDictNoTag = typing.TypedDict('_FixelfilterParamsDictNoTag', {
    "matrix": InputPathType,
    "threshold_value": typing.NotRequired[float | None],
    "threshold_connectivity": typing.NotRequired[float | None],
    "fwhm": typing.NotRequired[float | None],
    "minweight": typing.NotRequired[float | None],
    "mask": typing.NotRequired[InputPathType | None],
    "info": bool,
    "quiet": bool,
    "debug": bool,
    "force": bool,
    "nthreads": typing.NotRequired[int | None],
    "config": typing.NotRequired[list[FixelfilterConfigParamsDict] | None],
    "help": bool,
    "version": bool,
    "input": typing.Union[FixelfilterVariousStringParamsDictTagged, FixelfilterVariousFileParamsDictTagged],
    "filter": str,
    "output": typing.Union[FixelfilterVariousString1ParamsDictTagged, FixelfilterVariousFile1ParamsDictTagged],
})
FixelfilterParamsDictTagged = typing.TypedDict('FixelfilterParamsDictTagged', {
    "@type": typing.Literal["mrtrix/fixelfilter"],
    "matrix": InputPathType,
    "threshold_value": typing.NotRequired[float | None],
    "threshold_connectivity": typing.NotRequired[float | None],
    "fwhm": typing.NotRequired[float | None],
    "minweight": typing.NotRequired[float | None],
    "mask": typing.NotRequired[InputPathType | None],
    "info": bool,
    "quiet": bool,
    "debug": bool,
    "force": bool,
    "nthreads": typing.NotRequired[int | None],
    "config": typing.NotRequired[list[FixelfilterConfigParamsDict] | None],
    "help": bool,
    "version": bool,
    "input": typing.Union[FixelfilterVariousStringParamsDictTagged, FixelfilterVariousFileParamsDictTagged],
    "filter": str,
    "output": typing.Union[FixelfilterVariousString1ParamsDictTagged, FixelfilterVariousFile1ParamsDictTagged],
})
FixelfilterParamsDict = _FixelfilterParamsDictNoTag | FixelfilterParamsDictTagged


def fixelfilter_input_cargs_dyn_fn(
    t: str,
) -> typing.Any:
    """
    Get build cargs function by command type.
    
    Args:
        t: Command type.
    Returns:
        Build cargs function.
    """
    return {
        "VariousString": fixelfilter_various_string_cargs,
        "VariousFile": fixelfilter_various_file_cargs,
    }.get(t)


def fixelfilter_input_validate_dyn_fn(
    t: str,
) -> typing.Any:
    """
    Get validate params function by command type.
    
    Args:
        t: Command type.
    Returns:
        Validate params function.
    """
    return {
        "VariousString": fixelfilter_various_string_validate,
        "VariousFile": fixelfilter_various_file_validate,
    }.get(t)


def fixelfilter_output_cargs_dyn_fn(
    t: str,
) -> typing.Any:
    """
    Get build cargs function by command type.
    
    Args:
        t: Command type.
    Returns:
        Build cargs function.
    """
    return {
        "VariousString_1": fixelfilter_various_string_1_cargs,
        "VariousFile_1": fixelfilter_various_file_1_cargs,
    }.get(t)


def fixelfilter_output_validate_dyn_fn(
    t: str,
) -> typing.Any:
    """
    Get validate params function by command type.
    
    Args:
        t: Command type.
    Returns:
        Validate params function.
    """
    return {
        "VariousString_1": fixelfilter_various_string_1_validate,
        "VariousFile_1": fixelfilter_various_file_1_validate,
    }.get(t)


def fixelfilter_config(
    key: str,
    value: str,
) -> FixelfilterConfigParamsDictTagged:
    """
    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 fixelfilter_config_validate(
    params: typing.Any,
) -> None:
    """
    Validate parameters. Throws an error if `params` is not a valid
    `FixelfilterConfigParamsDict` 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 fixelfilter_config_cargs(
    params: FixelfilterConfigParamsDict,
    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


def fixelfilter_various_string(
    obj: str,
) -> FixelfilterVariousStringParamsDictTagged:
    """
    Build parameters.
    
    Args:
        obj: String object.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "VariousString",
        "obj": obj,
    }
    return params


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


def fixelfilter_various_string_cargs(
    params: FixelfilterVariousStringParamsDict,
    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(params.get("obj", None))
    return cargs


def fixelfilter_various_file(
    obj: InputPathType,
) -> FixelfilterVariousFileParamsDictTagged:
    """
    Build parameters.
    
    Args:
        obj: File object.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "VariousFile",
        "obj": obj,
    }
    return params


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


def fixelfilter_various_file_cargs(
    params: FixelfilterVariousFileParamsDict,
    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("obj", None)))
    return cargs


def fixelfilter_various_string_1(
    obj: str,
) -> FixelfilterVariousString1ParamsDictTagged:
    """
    Build parameters.
    
    Args:
        obj: String object.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "VariousString_1",
        "obj": obj,
    }
    return params


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


def fixelfilter_various_string_1_cargs(
    params: FixelfilterVariousString1ParamsDict,
    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(params.get("obj", None))
    return cargs


def fixelfilter_various_file_1(
    obj: InputPathType,
) -> FixelfilterVariousFile1ParamsDictTagged:
    """
    Build parameters.
    
    Args:
        obj: File object.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "VariousFile_1",
        "obj": obj,
    }
    return params


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


def fixelfilter_various_file_1_cargs(
    params: FixelfilterVariousFile1ParamsDict,
    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("obj", None)))
    return cargs


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


def fixelfilter_params(
    matrix: InputPathType,
    input_: typing.Union[FixelfilterVariousStringParamsDictTagged, FixelfilterVariousFileParamsDictTagged],
    filter_: str,
    output: typing.Union[FixelfilterVariousString1ParamsDictTagged, FixelfilterVariousFile1ParamsDictTagged],
    threshold_value: float | None = None,
    threshold_connectivity: float | None = None,
    fwhm: float | None = None,
    minweight: float | None = None,
    mask: InputPathType | None = None,
    info: bool = False,
    quiet: bool = False,
    debug: bool = False,
    force: bool = False,
    nthreads: int | None = None,
    config: list[FixelfilterConfigParamsDict] | None = None,
    help_: bool = False,
    version: bool = False,
) -> FixelfilterParamsDictTagged:
    """
    Build parameters.
    
    Args:
        matrix: provide a fixel-fixel connectivity matrix for filtering\
            operations that require it.
        input_: the input: either a fixel data file, or a fixel directory (see\
            Description).
        filter_: the filtering operation to perform; options are: connect,\
            smooth.
        output: the output: either a fixel data file, or a fixel directory (see\
            Description).
        threshold_value: specify a threshold for the input fixel data file\
            values (default = 0.5).
        threshold_connectivity: specify a fixel-fixel connectivity threshold\
            for connected-component analysis (default = 0.10000000000000001).
        fwhm: the full-width half-maximum (FWHM) of the spatial component of\
            the smoothing filter (default = 10mm).
        minweight: apply a minimum threshold to smoothing weights (default =\
            0.01).
        mask: only perform smoothing within a specified binary fixel mask.
        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/fixelfilter",
        "matrix": matrix,
        "info": info,
        "quiet": quiet,
        "debug": debug,
        "force": force,
        "help": help_,
        "version": version,
        "input": input_,
        "filter": filter_,
        "output": output,
    }
    if threshold_value is not None:
        params["threshold_value"] = threshold_value
    if threshold_connectivity is not None:
        params["threshold_connectivity"] = threshold_connectivity
    if fwhm is not None:
        params["fwhm"] = fwhm
    if minweight is not None:
        params["minweight"] = minweight
    if mask is not None:
        params["mask"] = mask
    if nthreads is not None:
        params["nthreads"] = nthreads
    if config is not None:
        params["config"] = config
    return params


def fixelfilter_validate(
    params: typing.Any,
) -> None:
    """
    Validate parameters. Throws an error if `params` is not a valid
    `FixelfilterParamsDict` 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("matrix", None) is None:
        raise StyxValidationError("`matrix` must not be None")
    if not isinstance(params["matrix"], (pathlib.Path, str)):
        raise StyxValidationError(f'`matrix` has the wrong type: Received `{type(params.get("matrix", None))}` expected `InputPathType`')
    if params.get("threshold_value", None) is not None:
        if not isinstance(params["threshold_value"], (float, int)):
            raise StyxValidationError(f'`threshold_value` has the wrong type: Received `{type(params.get("threshold_value", None))}` expected `float | None`')
    if params.get("threshold_connectivity", None) is not None:
        if not isinstance(params["threshold_connectivity"], (float, int)):
            raise StyxValidationError(f'`threshold_connectivity` has the wrong type: Received `{type(params.get("threshold_connectivity", None))}` expected `float | None`')
    if params.get("fwhm", None) is not None:
        if not isinstance(params["fwhm"], (float, int)):
            raise StyxValidationError(f'`fwhm` has the wrong type: Received `{type(params.get("fwhm", None))}` expected `float | None`')
    if params.get("minweight", None) is not None:
        if not isinstance(params["minweight"], (float, int)):
            raise StyxValidationError(f'`minweight` has the wrong type: Received `{type(params.get("minweight", None))}` expected `float | None`')
    if params.get("mask", None) is not None:
        if not isinstance(params["mask"], (pathlib.Path, str)):
            raise StyxValidationError(f'`mask` has the wrong type: Received `{type(params.get("mask", None))}` expected `InputPathType | 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[FixelfilterConfigParamsDict] | None`')
        for e in params["config"]:
            fixelfilter_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("input", None) is None:
        raise StyxValidationError("`input` must not be None")
    if not isinstance(params["input"], dict):
        raise StyxValidationError(f'Params object has the wrong type \'{type(params["input"])}\'')
    if "@type" not in params["input"]:
        raise StyxValidationError("Params object is missing `@type`")
    if params["input"]["@type"] not in ["VariousString", "VariousFile"]:
        raise StyxValidationError("Parameter `input`s `@type` must be one of [\"VariousString\", \"VariousFile\"]")
    fixelfilter_input_validate_dyn_fn(params["input"]["@type"])(params["input"])
    if params.get("filter", None) is None:
        raise StyxValidationError("`filter` must not be None")
    if not isinstance(params["filter"], str):
        raise StyxValidationError(f'`filter` has the wrong type: Received `{type(params.get("filter", None))}` expected `str`')
    if params.get("output", None) is None:
        raise StyxValidationError("`output` must not be None")
    if not isinstance(params["output"], dict):
        raise StyxValidationError(f'Params object has the wrong type \'{type(params["output"])}\'')
    if "@type" not in params["output"]:
        raise StyxValidationError("Params object is missing `@type`")
    if params["output"]["@type"] not in ["VariousString_1", "VariousFile_1"]:
        raise StyxValidationError("Parameter `output`s `@type` must be one of [\"VariousString_1\", \"VariousFile_1\"]")
    fixelfilter_output_validate_dyn_fn(params["output"]["@type"])(params["output"])


def fixelfilter_cargs(
    params: FixelfilterParamsDict,
    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("fixelfilter")
    cargs.extend([
        "-matrix",
        execution.input_file(params.get("matrix", None))
    ])
    if params.get("threshold_value", None) is not None:
        cargs.extend([
            "-threshold_value",
            str(params.get("threshold_value", None))
        ])
    if params.get("threshold_connectivity", None) is not None:
        cargs.extend([
            "-threshold_connectivity",
            str(params.get("threshold_connectivity", None))
        ])
    if params.get("fwhm", None) is not None:
        cargs.extend([
            "-fwhm",
            str(params.get("fwhm", None))
        ])
    if params.get("minweight", None) is not None:
        cargs.extend([
            "-minweight",
            str(params.get("minweight", None))
        ])
    if params.get("mask", None) is not None:
        cargs.extend([
            "-mask",
            execution.input_file(params.get("mask", 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 [fixelfilter_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.extend(fixelfilter_input_cargs_dyn_fn(params.get("input", None)["@type"])(params.get("input", None), execution))
    cargs.append(params.get("filter", None))
    cargs.extend(fixelfilter_output_cargs_dyn_fn(params.get("output", None)["@type"])(params.get("output", None), execution))
    return cargs


def fixelfilter_outputs(
    params: FixelfilterParamsDict,
    execution: Execution,
) -> FixelfilterOutputs:
    """
    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 = FixelfilterOutputs(
        root=execution.output_file("."),
    )
    return ret


def fixelfilter_execute(
    params: FixelfilterParamsDict,
    runner: Runner | None = None,
) -> FixelfilterOutputs:
    """
    fixelfilter
    
    Perform filtering operations on fixel-based data.
    
    If the first input to the command is a specific fixel data file, then a
    filtered version of only that file will be generated by the command.
    Alternatively, if the input is the location of a fixel directory, then the
    command will create a duplicate of the fixel directory, and apply the
    specified filter operation to all fixel data files within the directory.
    
    References:
    
    .
    
    Author: MRTrix3 Developers
    
    URL: https://www.mrtrix.org/
    
    Args:
        params: The parameters.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `FixelfilterOutputs`).
    """
    fixelfilter_validate(params)
    runner = runner or get_global_runner()
    execution = runner.start_execution(FIXELFILTER_METADATA)
    params = execution.params(params)
    cargs = fixelfilter_cargs(params, execution)
    ret = fixelfilter_outputs(params, execution)
    execution.run(cargs)
    return ret


def fixelfilter(
    matrix: InputPathType,
    input_: typing.Union[FixelfilterVariousStringParamsDictTagged, FixelfilterVariousFileParamsDictTagged],
    filter_: str,
    output: typing.Union[FixelfilterVariousString1ParamsDictTagged, FixelfilterVariousFile1ParamsDictTagged],
    threshold_value: float | None = None,
    threshold_connectivity: float | None = None,
    fwhm: float | None = None,
    minweight: float | None = None,
    mask: InputPathType | None = None,
    info: bool = False,
    quiet: bool = False,
    debug: bool = False,
    force: bool = False,
    nthreads: int | None = None,
    config: list[FixelfilterConfigParamsDict] | None = None,
    help_: bool = False,
    version: bool = False,
    runner: Runner | None = None,
) -> FixelfilterOutputs:
    """
    fixelfilter
    
    Perform filtering operations on fixel-based data.
    
    If the first input to the command is a specific fixel data file, then a
    filtered version of only that file will be generated by the command.
    Alternatively, if the input is the location of a fixel directory, then the
    command will create a duplicate of the fixel directory, and apply the
    specified filter operation to all fixel data files within the directory.
    
    References:
    
    .
    
    Author: MRTrix3 Developers
    
    URL: https://www.mrtrix.org/
    
    Args:
        matrix: provide a fixel-fixel connectivity matrix for filtering\
            operations that require it.
        input_: the input: either a fixel data file, or a fixel directory (see\
            Description).
        filter_: the filtering operation to perform; options are: connect,\
            smooth.
        output: the output: either a fixel data file, or a fixel directory (see\
            Description).
        threshold_value: specify a threshold for the input fixel data file\
            values (default = 0.5).
        threshold_connectivity: specify a fixel-fixel connectivity threshold\
            for connected-component analysis (default = 0.10000000000000001).
        fwhm: the full-width half-maximum (FWHM) of the spatial component of\
            the smoothing filter (default = 10mm).
        minweight: apply a minimum threshold to smoothing weights (default =\
            0.01).
        mask: only perform smoothing within a specified binary fixel mask.
        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 `FixelfilterOutputs`).
    """
    params = fixelfilter_params(
        matrix=matrix,
        threshold_value=threshold_value,
        threshold_connectivity=threshold_connectivity,
        fwhm=fwhm,
        minweight=minweight,
        mask=mask,
        info=info,
        quiet=quiet,
        debug=debug,
        force=force,
        nthreads=nthreads,
        config=config,
        help_=help_,
        version=version,
        input_=input_,
        filter_=filter_,
        output=output,
    )
    return fixelfilter_execute(params, runner)


__all__ = [
    "FIXELFILTER_METADATA",
    "FixelfilterConfigParamsDict",
    "FixelfilterConfigParamsDictTagged",
    "FixelfilterOutputs",
    "FixelfilterParamsDict",
    "FixelfilterParamsDictTagged",
    "FixelfilterVariousFile1ParamsDict",
    "FixelfilterVariousFile1ParamsDictTagged",
    "FixelfilterVariousFileParamsDict",
    "FixelfilterVariousFileParamsDictTagged",
    "FixelfilterVariousString1ParamsDict",
    "FixelfilterVariousString1ParamsDictTagged",
    "FixelfilterVariousStringParamsDict",
    "FixelfilterVariousStringParamsDictTagged",
    "fixelfilter",
    "fixelfilter_config",
    "fixelfilter_execute",
    "fixelfilter_params",
    "fixelfilter_various_file",
    "fixelfilter_various_file_1",
    "fixelfilter_various_string",
    "fixelfilter_various_string_1",
]
