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

import typing
import pathlib
from styxdefs import *
import dataclasses

ANTS_ALIGN_ORIGIN_METADATA = Metadata(
    id="6857aca2f492ef8646affc2ca57d3ca2675b0b13.boutiques",
    name="antsAlignOrigin",
    package="ants",
    container_image_tag="antsx/ants:v2.5.3",
)


class AntsAlignOriginOutputs(typing.NamedTuple):
    """
    Output object returned when calling `ants_align_origin(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    aligned_image: OutputPathType
    """The output is the aligned image."""


def ants_align_origin(
    input_: InputPathType,
    reference_image: InputPathType,
    output: InputPathType,
    dimensionality: typing.Literal[2, 3] | None = None,
    runner: Runner | None = None,
) -> AntsAlignOriginOutputs:
    """
    antsAlignOrigin, applied to an input image, transforms it according to a
    reference image and a transform (or a set of transforms).
    
    Author: ANTs Developers
    
    URL: https://github.com/ANTsX/ANTs
    
    Args:
        input_: Currently, the only input objects supported are image objects.\
            However, the current framework allows for warping of other objects such\
            as meshes and point sets.
        reference_image: For warping input images, the reference image defines\
            the spacing, origin, size, and direction of the output warped image.
        output: One can either output the warped image or, if the boolean is\
            set, one can print out the displacement field based on the composite\
            transform and the reference image.
        dimensionality: This option forces the image to be treated as a\
            specified-dimensional image. If not specified, antsWarp tries to infer\
            the dimensionality from the input image.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `AntsAlignOriginOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(ANTS_ALIGN_ORIGIN_METADATA)
    cargs = []
    cargs.append("antsAlignOrigin")
    if dimensionality is not None:
        cargs.extend([
            "--dimensionality",
            str(dimensionality)
        ])
    cargs.extend([
        "--input",
        execution.input_file(input_)
    ])
    cargs.extend([
        "--reference-image",
        execution.input_file(reference_image)
    ])
    cargs.extend([
        "--output",
        execution.input_file(output)
    ])
    ret = AntsAlignOriginOutputs(
        root=execution.output_file("."),
        aligned_image=execution.output_file(pathlib.Path(output).name),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "ANTS_ALIGN_ORIGIN_METADATA",
    "AntsAlignOriginOutputs",
    "ants_align_origin",
]
