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

import typing
import pathlib
from styxdefs import *
import dataclasses

V__2DWARPER_ALLIN_METADATA = Metadata(
    id="025f4fd73449077a7f27f71bce48a9a34a8bfe9d.boutiques",
    name="@2dwarper.Allin",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class V2dwarperAllinOutputs(typing.NamedTuple):
    """
    Output object returned when calling `v__2dwarper_allin(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    reg_output: OutputPathType | None
    """Output registered dataset"""
    param_files: OutputPathType | None
    """Output registration parameter files"""


def v__2dwarper_allin(
    input_prefix: str,
    mask_prefix: str | None = None,
    output_prefix: str | None = None,
    runner: Runner | None = None,
) -> V2dwarperAllinOutputs:
    """
    Perform 2D registration on each slice of a 3D+time dataset, and combine the
    results.
    
    Author: AFNI Developers
    
    URL: https://afni.nimh.nih.gov/
    
    Args:
        input_prefix: Prefix for the input 3D+time dataset.
        mask_prefix: Prefix of an existing mask dataset.
        output_prefix: Prefix for output datasets.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `V2dwarperAllinOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(V__2DWARPER_ALLIN_METADATA)
    cargs = []
    cargs.append("@2dwarper.Allin")
    cargs.append(input_prefix)
    if mask_prefix is not None:
        cargs.extend([
            "-mask",
            mask_prefix
        ])
    if output_prefix is not None:
        cargs.extend([
            "-prefix",
            output_prefix
        ])
    ret = V2dwarperAllinOutputs(
        root=execution.output_file("."),
        reg_output=execution.output_file(output_prefix + "_reg+orig.HEAD") if (output_prefix is not None) else None,
        param_files=execution.output_file(output_prefix + "_param_*.1D") if (output_prefix is not None) else None,
    )
    execution.run(cargs)
    return ret


__all__ = [
    "V2dwarperAllinOutputs",
    "V__2DWARPER_ALLIN_METADATA",
    "v__2dwarper_allin",
]
