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

import typing
import pathlib
from styxdefs import *
import dataclasses

CREATE_TILED_MOSAIC_METADATA = Metadata(
    id="62ba9b499dd56904d0e9344bc41632c426e55fc9.boutiques",
    name="CreateTiledMosaic",
    package="ants",
    container_image_tag="antsx/ants:v2.5.3",
)


class CreateTiledMosaicOutputs(typing.NamedTuple):
    """
    Output object returned when calling `create_tiled_mosaic(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    tiled_mosaic_image: OutputPathType
    """The output is the tiled mosaic image."""


def create_tiled_mosaic(
    input_image: InputPathType,
    output: InputPathType,
    rgb_image: InputPathType | None = None,
    mask_image: InputPathType | None = None,
    alpha: float | None = None,
    functional_overlay: str | None = None,
    tile_geometry: str | None = None,
    direction: typing.Literal["0", "1", "2", "x", "y", "z"] | None = None,
    pad_or_crop: str | None = None,
    slices: str | None = None,
    flip_slice: str | None = None,
    permute_axes: typing.Literal[0, 1] | None = None,
    runner: Runner | None = None,
) -> CreateTiledMosaicOutputs:
    """
    Render a 3-D image volume with optional Rgb overlay.
    
    Author: ANTs Developers
    
    URL: https://github.com/ANTsX/ANTs
    
    Args:
        input_image: Main input is a 3-D grayscale image.
        output: The output is the tiled mosaic image. The format must support\
            the specific data type: floating point images without RGB overlays, Rgb\
            images with intensities scaled to [0,255] if overlays are present.
        rgb_image: An optional Rgb image can be added as an overlay. It must\
            have the same image geometry as the input grayscale image.
        mask_image: Specifies the ROI of the RGB voxels used.
        alpha: If an Rgb image is provided, render the overlay using the\
            specified alpha parameter.
        functional_overlay: A functional overlay can be specified using both\
            and rgb image and a mask specifying where that rgb image should be\
            applied. Both images must have the same image geometry as the input\
            image. Optionally, an alpha parameter can be specified.
        tile_geometry: The tile geometry specifies the number of rows and\
            columns in the output image. For example, specifying '5x10' renders 5\
            rows by 10 columns of slices.
        direction: Specifies the direction of the slices. Can be based on image\
            storage in memory or aligned physical space. Defaults to z-direction if\
            unspecified.
        pad_or_crop: Specify padding or cropping with a voxel-width boundary\
            for each slice. Padding uses a specified constant value. Cropping pads\
            with negative voxel-widths.
        slices: Control over which slices to render. Specify slices directly or\
            incrementally with optional start and end slices.
        flip_slice: Flip individual slice images horizontally and/or\
            vertically.
        permute_axes: Permute (or swap) the axes of the individual slice\
            images.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `CreateTiledMosaicOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(CREATE_TILED_MOSAIC_METADATA)
    cargs = []
    cargs.append("CreateTiledMosaic")
    cargs.extend([
        "-i",
        execution.input_file(input_image)
    ])
    if rgb_image is not None:
        cargs.extend([
            "-r",
            execution.input_file(rgb_image)
        ])
    if mask_image is not None:
        cargs.extend([
            "-x",
            execution.input_file(mask_image)
        ])
    if alpha is not None:
        cargs.extend([
            "-a",
            str(alpha)
        ])
    if functional_overlay is not None:
        cargs.extend([
            "-e",
            functional_overlay
        ])
    cargs.extend([
        "-o",
        execution.input_file(output)
    ])
    if tile_geometry is not None:
        cargs.extend([
            "-t",
            tile_geometry
        ])
    if direction is not None:
        cargs.extend([
            "-d",
            direction
        ])
    if pad_or_crop is not None:
        cargs.extend([
            "-p",
            pad_or_crop
        ])
    if slices is not None:
        cargs.extend([
            "-s",
            slices
        ])
    if flip_slice is not None:
        cargs.extend([
            "-f",
            flip_slice
        ])
    if permute_axes is not None:
        cargs.extend([
            "-g",
            str(permute_axes)
        ])
    ret = CreateTiledMosaicOutputs(
        root=execution.output_file("."),
        tiled_mosaic_image=execution.output_file(pathlib.Path(output).name),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "CREATE_TILED_MOSAIC_METADATA",
    "CreateTiledMosaicOutputs",
    "create_tiled_mosaic",
]
