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

import typing
import pathlib
from styxdefs import *
import dataclasses

V_3D_TAGALIGN_METADATA = Metadata(
    id="3a36837ea87f9f5e5e1558ec63e13590efe2e614.boutiques",
    name="3dTagalign",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class V3dTagalignOutputs(typing.NamedTuple):
    """
    Output object returned when calling `v_3d_tagalign(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_dataset_head: OutputPathType | None
    """Output dataset in AFNI format (.HEAD)"""
    output_dataset_brick: OutputPathType | None
    """Output dataset in AFNI format (.BRIK)"""
    output_matvec_file: OutputPathType | None
    """Output transformation matrix and vector file"""


def v_3d_tagalign(
    master_dataset: InputPathType,
    input_dataset: InputPathType,
    tagset_file: InputPathType | None = None,
    no_keep_tags: bool = False,
    matvec_file: str | None = None,
    rotate: bool = False,
    affine: bool = False,
    rotscl: bool = False,
    prefix: str | None = None,
    verbose: bool = False,
    dummy: bool = False,
    runner: Runner | None = None,
) -> V3dTagalignOutputs:
    """
    Rotates/translates dataset 'dset' to be aligned with the master using the
    tagsets embedded in their .HEAD files.
    
    Author: AFNI Team
    
    URL: https://afni.nimh.nih.gov/pub/dist/doc/program_help/3dTagalign.html
    
    Args:
        master_dataset: Use dataset 'mset' as the master dataset. This option\
            is mandatory.
        input_dataset: Input dataset to align.
        tagset_file: Use the tagset in the .tag file instead of dset.
        no_keep_tags: Don't put transformed locations of dset's tags into the\
            output dataset [default = keep tags].
        matvec_file: Write the matrix+vector transformation to file 'mfile'.\
            This can be used with 3dWarp's '-matvec_in2out' option to align other\
            datasets in the same way (e.g., functional datasets).
        rotate: Compute the transformation as a rotation + shift (default).
        affine: Compute the transformation as a general affine map, where the\
            matrix is a general 3x3 matrix.
        rotscl: Compute transformation as a rotation times an isotropic\
            scaling; where matrix is an orthogonal matrix times a scalar.
        prefix: Specify the prefix for the output dataset.
        verbose: Print progress reports.
        dummy: Don't actually rotate the dataset, just compute the\
            transformation matrix and vector. If '-matvec' is used, the mfile will\
            be written.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `V3dTagalignOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(V_3D_TAGALIGN_METADATA)
    cargs = []
    cargs.append("3dTagalign")
    cargs.extend([
        "-master",
        execution.input_file(master_dataset)
    ])
    if tagset_file is not None:
        cargs.extend([
            "-tagset",
            execution.input_file(tagset_file)
        ])
    if no_keep_tags:
        cargs.append("-nokeeptags")
    if matvec_file is not None:
        cargs.extend([
            "-matvec",
            matvec_file
        ])
    if rotate:
        cargs.append("-rotate")
    if affine:
        cargs.append("-affine")
    if rotscl:
        cargs.append("-rotscl")
    if prefix is not None:
        cargs.extend([
            "-prefix",
            prefix
        ])
    if verbose:
        cargs.append("-verb")
    if dummy:
        cargs.append("-dummy")
    cargs.append("[INTERPOLATION_METHOD]")
    cargs.append(execution.input_file(input_dataset))
    ret = V3dTagalignOutputs(
        root=execution.output_file("."),
        output_dataset_head=execution.output_file(prefix + "+orig.HEAD") if (prefix is not None) else None,
        output_dataset_brick=execution.output_file(prefix + "+orig.BRIK") if (prefix is not None) else None,
        output_matvec_file=execution.output_file(matvec_file) if (matvec_file is not None) else None,
    )
    execution.run(cargs)
    return ret


__all__ = [
    "V3dTagalignOutputs",
    "V_3D_TAGALIGN_METADATA",
    "v_3d_tagalign",
]
