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

import typing
import pathlib
from styxdefs import *
import dataclasses

V_3D_ALLINEATE_METADATA = Metadata(
    id="2805815dd8dbceb7916da4052ea862dc05a5fa87.boutiques",
    name="3dAllineate",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class V3dAllineateOutputs(typing.NamedTuple):
    """
    Output object returned when calling `v_3d_allineate(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    out_brik: OutputPathType
    """Output dataset brick file"""
    out_head: OutputPathType
    """Output dataset head file"""
    out_param_save: OutputPathType
    """File holding saved warp parameters"""
    out_matrix_save: OutputPathType
    """File holding saved matrix transformations"""


def v_3d_allineate(
    source: InputPathType,
    prefix: str,
    base: InputPathType | None = None,
    runner: Runner | None = None,
) -> V3dAllineateOutputs:
    """
    Program to align one dataset (the 'source') to a 'base' dataset using an affine
    (matrix) transformation of space.
    
    Author: AFNI Team
    
    URL: https://afni.nimh.nih.gov/pub/dist/doc/program_help/3dAllineate.html
    
    Args:
        source: Source dataset file.
        prefix: Output prefix.
        base: Base dataset file.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `V3dAllineateOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(V_3D_ALLINEATE_METADATA)
    cargs = []
    cargs.append("3dAllineate")
    cargs.append(execution.input_file(source))
    if base is not None:
        cargs.extend([
            "-base",
            execution.input_file(base)
        ])
    cargs.extend([
        "-prefix",
        prefix
    ])
    cargs.append("[OPTIONS]")
    ret = V3dAllineateOutputs(
        root=execution.output_file("."),
        out_brik=execution.output_file(prefix + "+orig.BRIK"),
        out_head=execution.output_file(prefix + "+orig.HEAD"),
        out_param_save=execution.output_file("[1DPARAM_SAVE]"),
        out_matrix_save=execution.output_file("[1DMATRIX_SAVE]"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "V3dAllineateOutputs",
    "V_3D_ALLINEATE_METADATA",
    "v_3d_allineate",
]
