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

import typing
import pathlib
from styxdefs import *
import dataclasses

FIXEL2PEAKS_METADATA = Metadata(
    id="98ed9c18cf276e5b938d70b66727959cf8643284.boutiques",
    name="fixel2peaks",
    package="mrtrix",
    container_image_tag="mrtrix3/mrtrix3:3.0.4",
)


@dataclasses.dataclass
class Fixel2peaksConfig:
    """
    temporarily set the value of an MRtrix config file entry.
    """
    key: str
    """temporarily set the value of an MRtrix config file entry."""
    value: str
    """temporarily set the value of an MRtrix config file entry."""
    
    def run(
        self,
        execution: Execution,
    ) -> list[str]:
        """
        Build command line arguments. This method is called by the main command.
        
        Args:
            execution: The execution object.
        Returns:
            Command line arguments
        """
        cargs = []
        cargs.append("-config")
        cargs.append(self.key)
        cargs.append(self.value)
        return cargs


class Fixel2peaksOutputs(typing.NamedTuple):
    """
    Output object returned when calling `fixel2peaks(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    out: OutputPathType
    """the output peaks image"""


def fixel2peaks(
    in_: str,
    out: str,
    number: int | None = None,
    nan: bool = False,
    info: bool = False,
    quiet: bool = False,
    debug: bool = False,
    force: bool = False,
    nthreads: int | None = None,
    config: list[Fixel2peaksConfig] | None = None,
    help_: bool = False,
    version: bool = False,
    runner: Runner | None = None,
) -> Fixel2peaksOutputs:
    """
    Convert data in the fixel directory format into a 4D image of 3-vectors.
    
    If a fixel data file is provided as input, then the 3-vectors in the output
    image will be scaled based on the data in that file. If the input is instead
    the fixel directory, or the index or directions file, then all output
    3-vectors will possess unit norm.
    
    References:
    
    .
    
    Author: Robert E. Smith (robert.smith@florey.edu.au)
    
    URL:
    https://mrtrix.readthedocs.io/en/latest/reference/commands/fixel2peaks.html
    
    Args:
        in_: the input fixel information.
        out: the output peaks image.
        number: maximum number of fixels in each voxel (default: based on input\
            data).
        nan: fill excess peak data with NaNs rather than zeroes.
        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 `Fixel2peaksOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(FIXEL2PEAKS_METADATA)
    cargs = []
    cargs.append("fixel2peaks")
    if number is not None:
        cargs.extend([
            "-number",
            str(number)
        ])
    if nan:
        cargs.append("-nan")
    if info:
        cargs.append("-info")
    if quiet:
        cargs.append("-quiet")
    if debug:
        cargs.append("-debug")
    if force:
        cargs.append("-force")
    if nthreads is not None:
        cargs.extend([
            "-nthreads",
            str(nthreads)
        ])
    if config is not None:
        cargs.extend([a for c in [s.run(execution) for s in config] for a in c])
    if help_:
        cargs.append("-help")
    if version:
        cargs.append("-version")
    cargs.append(in_)
    cargs.append(out)
    ret = Fixel2peaksOutputs(
        root=execution.output_file("."),
        out=execution.output_file(out),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "FIXEL2PEAKS_METADATA",
    "Fixel2peaksConfig",
    "Fixel2peaksOutputs",
    "fixel2peaks",
]
