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

import typing
import pathlib
from styxdefs import *
import dataclasses

V_3D_WARP_DRIVE_METADATA = Metadata(
    id="94f1a8dd63cf363a9c26a553457737d194dec4be.boutiques",
    name="3dWarpDrive",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class V3dWarpDriveOutputs(typing.NamedTuple):
    """
    Output object returned when calling `v_3d_warp_drive(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_dataset: OutputPathType
    """Warped dataset output"""
    output_summary: OutputPathType
    """Summary of calculations"""
    oned_output_file: OutputPathType
    """File with warping parameters"""
    matrix_output_file: OutputPathType
    """File with transformation matrices"""


def v_3d_warp_drive(
    base_dataset: InputPathType,
    prefix: str,
    dataset: InputPathType,
    bilinear_general: bool = False,
    quintic: bool = False,
    runner: Runner | None = None,
) -> V3dWarpDriveOutputs:
    """
    Warp a dataset to match another one (the base) using an affine transformation.
    
    Author: AFNI Team
    
    URL: https://afni.nimh.nih.gov/pub/dist/doc/program_help/3dWarpDrive.html
    
    Args:
        base_dataset: Load dataset as the base to which the input dataset will\
            be matched. This is a mandatory option.
        prefix: Sets the prefix of the output dataset. If 'NULL', no output\
            dataset is written.
        dataset: Input dataset.
        bilinear_general: 39 parameters (3 + 3x3 + 3x3x3). Not implemented and\
            will never be.
        quintic: Quintic interpolation method.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `V3dWarpDriveOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(V_3D_WARP_DRIVE_METADATA)
    cargs = []
    cargs.append("3dWarpDrive")
    if bilinear_general:
        cargs.append("-bilinear_general")
    if quintic:
        cargs.append("-quintic")
    cargs.append("-base")
    cargs.extend([
        "-base",
        execution.input_file(base_dataset)
    ])
    cargs.append("-prefix")
    cargs.extend([
        "-prefix",
        prefix
    ])
    cargs.append("[TECHNICAL_OPTIONS]")
    cargs.append(execution.input_file(dataset))
    ret = V3dWarpDriveOutputs(
        root=execution.output_file("."),
        output_dataset=execution.output_file(prefix + "+orig"),
        output_summary=execution.output_file("[SUMMARY]"),
        oned_output_file=execution.output_file("[1DFILE]"),
        matrix_output_file=execution.output_file("[1DMATRIX_SAVE]"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "V3dWarpDriveOutputs",
    "V_3D_WARP_DRIVE_METADATA",
    "v_3d_warp_drive",
]
