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

import typing
import pathlib
from styxdefs import *
import dataclasses

REBASE_TENSOR_IMAGE_METADATA = Metadata(
    id="cb7dc4431e44610b96f7d5021a64651fd63ad535.boutiques",
    name="RebaseTensorImage",
    package="ants",
    container_image_tag="antsx/ants:v2.5.3",
)


class RebaseTensorImageOutputs(typing.NamedTuple):
    """
    Output object returned when calling `rebase_tensor_image(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    rebased_image: OutputPathType
    """The rebased tensor image."""


def rebase_tensor_image(
    dimension: int,
    infile: InputPathType,
    outfile: InputPathType,
    method: typing.Literal["PHYSICAL", "LOCAL"],
    reference: InputPathType | None = None,
    runner: Runner | None = None,
) -> RebaseTensorImageOutputs:
    """
    Rebase Tensor Image using specified dimensionality and method.
    
    Author: ANTs Developers
    
    URL: https://github.com/ANTsX/ANTs
    
    Args:
        dimension: The dimensionality of the input image.
        infile: The input image file.
        outfile: The output image file.
        method: Method of rebasing the tensor image.
        reference: Reference image file (required if PHYSICAL or LOCAL method\
            is chosen).
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `RebaseTensorImageOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(REBASE_TENSOR_IMAGE_METADATA)
    cargs = []
    cargs.append("RebaseTensorImage")
    cargs.append(str(dimension))
    cargs.append(execution.input_file(infile))
    cargs.append(execution.input_file(outfile))
    cargs.append(method)
    if reference is not None:
        cargs.append(execution.input_file(reference))
    ret = RebaseTensorImageOutputs(
        root=execution.output_file("."),
        rebased_image=execution.output_file(pathlib.Path(outfile).name),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "REBASE_TENSOR_IMAGE_METADATA",
    "RebaseTensorImageOutputs",
    "rebase_tensor_image",
]
