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

import typing
import pathlib
from styxdefs import *
import dataclasses

V_3DRESAMPLE_METADATA = Metadata(
    id="0d87d38a4f7c77290f6d466ec9698d61440eb3e2.boutiques",
    name="3dresample",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class V3dresampleOutputs(typing.NamedTuple):
    """
    Output object returned when calling `v_3dresample(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    out_file: OutputPathType
    """Output image file name."""


def v_3dresample(
    in_file: InputPathType,
    prefix: str,
    master: InputPathType | None = None,
    orientation: typing.Literal["AIL", "AIR", "ASL", "ASR", "PIL", "PIR", "PSL", "PSR", "ALI", "ALS", "ARI", "ARS", "PLI", "PLS", "PRI", "PRS", "IAL", "IAR", "IPL", "IPR", "SAL", "SAR", "SPL", "SPR", "ILA", "ILP", "IRA", "IRP", "SLA", "SLP", "SRA", "SRP", "LAI", "LAS", "LPI", "LPS", "RAI", "RAS", "RPI", "RPS", "LIA", "LIP", "LSA", "LSP", "RIA", "RIP", "RSA", "RSP"] | None = None,
    outputtype: typing.Literal["NIFTI", "AFNI", "NIFTI_GZ"] | None = None,
    resample_mode: typing.Literal["NN", "Li", "Cu", "Bk"] | None = None,
    voxel_size: list[float] | None = None,
    runner: Runner | None = None,
) -> V3dresampleOutputs:
    """
    Resample or reorient an image using AFNI 3dresample command.
    
    Author: AFNI Developers
    
    URL: https://afni.nimh.nih.gov/
    
    Args:
        in_file: Input file to 3dresample.
        prefix: required prefix for output dataset.
        master: Align dataset grid to a reference file.
        orientation: New orientation code.
        outputtype: 'nifti' or 'afni' or 'nifti_gz'. Afni output filetype.
        resample_mode: 'nn' or 'li' or 'cu' or 'bk'. Resampling method from set\
            {"nn", "li", "cu", "bk"}. these are for "nearest neighbor", "linear",\
            "cubic" and "blocky"interpolation, respectively. default is nn.
        voxel_size: (a float, a float, a float). Resample to new dx, dy and dz.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `V3dresampleOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(V_3DRESAMPLE_METADATA)
    cargs = []
    cargs.append("3dresample")
    cargs.extend([
        "-inset",
        execution.input_file(in_file)
    ])
    if master is not None:
        cargs.extend([
            "-master",
            execution.input_file(master)
        ])
    if orientation is not None:
        cargs.extend([
            "-orient",
            orientation
        ])
    cargs.extend([
        "-prefix",
        prefix
    ])
    if outputtype is not None:
        cargs.append(outputtype)
    if resample_mode is not None:
        cargs.extend([
            "-rmode",
            resample_mode
        ])
    if voxel_size is not None:
        cargs.extend([
            "-dxyz",
            *map(str, voxel_size)
        ])
    ret = V3dresampleOutputs(
        root=execution.output_file("."),
        out_file=execution.output_file(prefix),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "V3dresampleOutputs",
    "V_3DRESAMPLE_METADATA",
    "v_3dresample",
]
