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

import typing
import pathlib
from styxdefs import *
import dataclasses

OVERLAY_METADATA = Metadata(
    id="1b2de06d3c3c55476b10678cfb33eedfc35927e0.boutiques",
    name="overlay",
    package="fsl",
    container_image_tag="mcin/fsl:6.0.5",
)


class OverlayOutputs(typing.NamedTuple):
    """
    Output object returned when calling `overlay(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    out_file_outfile: OutputPathType | None
    """Combined image volume."""


def overlay(
    background_image: InputPathType,
    stat_image: InputPathType,
    stat_thresh: list[float],
    out_type: typing.Literal["float", "int"] | None = "float",
    use_checkerboard: bool = False,
    full_bg_range: bool = False,
    stat_image2: InputPathType | None = None,
    stat_thresh2: list[float] | None = None,
    out_file: InputPathType | None = None,
    output_type: typing.Literal["NIFTI", "NIFTI_PAIR", "NIFTI_GZ", "NIFTI_PAIR_GZ"] | None = None,
    runner: Runner | None = None,
) -> OverlayOutputs:
    """
    Use FSL's overlay command to combine background and statistical images into one
    volume.
    
    Author: Nipype (interface)
    
    Args:
        background_image: Image to use as background.
        stat_image: Statistical image to overlay in color.
        stat_thresh: (a float, a float). Min and max values for the statistical\
            overlay.
        out_type: 'float' or 'int'. Write output with float or int.
        use_checkerboard: Use checkerboard mask for overlay.
        full_bg_range: Use full range of background image.
        stat_image2: Second statistical image to overlay in color.
        stat_thresh2: (a float, a float). Min and max values for second\
            statistical overlay.
        out_file: Combined image volume.
        output_type: 'nifti' or 'nifti_pair' or 'nifti_gz' or 'nifti_pair_gz'.\
            Fsl output type.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `OverlayOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(OVERLAY_METADATA)
    cargs = []
    cargs.append("Overlay")
    cargs.append("[TRANSPARENCY]")
    if out_type is not None:
        cargs.append(out_type)
    if use_checkerboard:
        cargs.append("-c")
    cargs.append(execution.input_file(background_image))
    if full_bg_range:
        cargs.append("-A")
    cargs.append(execution.input_file(stat_image))
    cargs.extend(map(str, stat_thresh))
    cargs.append("[SHOW_NEGATIVE_STATS]")
    if stat_image2 is not None:
        cargs.append(execution.input_file(stat_image2))
    if stat_thresh2 is not None:
        cargs.extend(map(str, stat_thresh2))
    if out_file is not None:
        cargs.append(execution.input_file(out_file))
    if output_type is not None:
        cargs.append(output_type)
    ret = OverlayOutputs(
        root=execution.output_file("."),
        out_file_outfile=execution.output_file(pathlib.Path(out_file).name) if (out_file is not None) else None,
    )
    execution.run(cargs)
    return ret


__all__ = [
    "OVERLAY_METADATA",
    "OverlayOutputs",
    "overlay",
]
