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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRCOLOUR_METADATA = Metadata(
    id="13304bc23ae97d64cedc37fef80da355a36e5b22.boutiques",
    name="mrcolour",
    package="mrtrix",
    container_image_tag="mrtrix3/mrtrix3:3.0.4",
)


@dataclasses.dataclass
class MrcolourConfig:
    """
    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 MrcolourOutputs(typing.NamedTuple):
    """
    Output object returned when calling `mrcolour(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output: OutputPathType
    """the output image"""


def mrcolour(
    input_: InputPathType,
    map_: str,
    output: str,
    upper: float | None = None,
    lower: float | None = None,
    colour: list[float] | None = None,
    info: bool = False,
    quiet: bool = False,
    debug: bool = False,
    force: bool = False,
    nthreads: int | None = None,
    config: list[MrcolourConfig] | None = None,
    help_: bool = False,
    version: bool = False,
    runner: Runner | None = None,
) -> MrcolourOutputs:
    """
    Apply a colour map to an image.
    
    Under typical usage, this command will receive as input ad 3D greyscale
    image, and output a 4D image with 3 volumes corresponding to red-green-blue
    components; other use cases are possible, and are described in more detail
    below.
    
    By default, the command will automatically determine the maximum and minimum
    intensities of the input image, and use that information to set the upper
    and lower bounds of the applied colourmap. This behaviour can be overridden
    by manually specifying these bounds using the -upper and -lower options
    respectively.
    
    References:
    
    .
    
    Author: Robert E. Smith (robert.smith@florey.edu.au)
    
    URL:
    https://mrtrix.readthedocs.io/en/latest/reference/commands/mrcolour.html
    
    Args:
        input_: the input image.
        map_: the colourmap to apply; choices are:\
            gray,hot,cool,jet,inferno,viridis,pet,colour,rgb.
        output: the output image.
        upper: manually set the upper intensity of the colour mapping.
        lower: manually set the lower intensity of the colour mapping.
        colour: set the target colour for use of the 'colour' map (three\
            comma-separated floating-point values).
        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 `MrcolourOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRCOLOUR_METADATA)
    cargs = []
    cargs.append("mrcolour")
    if upper is not None:
        cargs.extend([
            "-upper",
            str(upper)
        ])
    if lower is not None:
        cargs.extend([
            "-lower",
            str(lower)
        ])
    if colour is not None:
        cargs.extend([
            "-colour",
            ",".join(map(str, colour))
        ])
    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(execution.input_file(input_))
    cargs.append(map_)
    cargs.append(output)
    ret = MrcolourOutputs(
        root=execution.output_file("."),
        output=execution.output_file(output),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRCOLOUR_METADATA",
    "MrcolourConfig",
    "MrcolourOutputs",
    "mrcolour",
]
