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

import typing
import pathlib
from styxdefs import *
import dataclasses

FIXELCONVERT_METADATA = Metadata(
    id="61e22f7f494e1cc9061508aaffc5a41839e5a5fa.boutiques",
    name="fixelconvert",
    package="mrtrix",
    container_image_tag="mrtrix3/mrtrix3:3.0.4",
)


@dataclasses.dataclass
class FixelconvertConfig:
    """
    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


@dataclasses.dataclass
class FixelconvertVariousString:
    obj: str
    """String object."""
    
    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(self.obj)
        return cargs


@dataclasses.dataclass
class FixelconvertVariousFile:
    obj: InputPathType
    """File object."""
    
    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(execution.input_file(self.obj))
        return cargs


@dataclasses.dataclass
class FixelconvertVariousString_:
    obj: str
    """String object."""
    
    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(self.obj)
        return cargs


@dataclasses.dataclass
class FixelconvertVariousFile_:
    obj: InputPathType
    """File object."""
    
    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(execution.input_file(self.obj))
        return cargs


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


def fixelconvert(
    fixel_in: typing.Union[FixelconvertVariousString, FixelconvertVariousFile],
    fixel_out: typing.Union[FixelconvertVariousString_, FixelconvertVariousFile_],
    name: str | None = None,
    nii: bool = False,
    out_size: bool = False,
    template: InputPathType | None = None,
    value: InputPathType | None = None,
    in_size: InputPathType | None = None,
    info: bool = False,
    quiet: bool = False,
    debug: bool = False,
    force: bool = False,
    nthreads: int | None = None,
    config: list[FixelconvertConfig] | None = None,
    help_: bool = False,
    version: bool = False,
    runner: Runner | None = None,
) -> FixelconvertOutputs:
    """
    Convert between the old format fixel image (.msf / .msh) and the new fixel
    directory format.
    
    
    
    References:
    
    .
    
    Author: MRTrix3 Developers
    
    URL: https://www.mrtrix.org/
    
    Args:
        fixel_in: the input fixel file / directory.
        fixel_out: the output fixel file / directory.
        name: assign a different name to the value field output (Default:\
            value). Do not include the file extension.
        nii: output the index, directions and data file in NIfTI format instead\
            of .mif.
        out_size: also output the 'size' field from the old format.
        template: specify an existing fixel directory (in the new format) to\
            which the new output should conform.
        value: nominate the data file to import to the 'value' field in the old\
            format.
        in_size: import data for the 'size' field in the old format.
        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 `FixelconvertOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(FIXELCONVERT_METADATA)
    cargs = []
    cargs.append("fixelconvert")
    if name is not None:
        cargs.extend([
            "-name",
            name
        ])
    if nii:
        cargs.append("-nii")
    if out_size:
        cargs.append("-out_size")
    if template is not None:
        cargs.extend([
            "-template",
            execution.input_file(template)
        ])
    if value is not None:
        cargs.extend([
            "-value",
            execution.input_file(value)
        ])
    if in_size is not None:
        cargs.extend([
            "-in_size",
            execution.input_file(in_size)
        ])
    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.extend(fixel_in.run(execution))
    cargs.extend(fixel_out.run(execution))
    ret = FixelconvertOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "FIXELCONVERT_METADATA",
    "FixelconvertConfig",
    "FixelconvertOutputs",
    "FixelconvertVariousFile",
    "FixelconvertVariousFile_",
    "FixelconvertVariousString",
    "FixelconvertVariousString_",
    "fixelconvert",
]
