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

import typing
import pathlib
from styxdefs import *
import dataclasses

ADWARP_METADATA = Metadata(
    id="22410e65c1361d9cb6b13a0fd56cc72bae69129b.boutiques",
    name="adwarp",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class AdwarpOutputs(typing.NamedTuple):
    """
    Output object returned when calling `adwarp(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    header_output: OutputPathType | None
    """Output dataset header file"""
    brick_output: OutputPathType | None
    """Output dataset brick file"""


def adwarp(
    apar: InputPathType,
    dpar: str,
    prefix: str | None = None,
    dxyz: float | None = None,
    verbose: bool = False,
    force: bool = False,
    resam: str | None = None,
    thr: str | None = None,
    func: str | None = None,
    runner: Runner | None = None,
) -> AdwarpOutputs:
    """
    Resamples a 'data parent' dataset to the grid defined by an 'anat parent'
    dataset.
    
    Author: AFNI Developers
    
    URL: https://afni.nimh.nih.gov/
    
    Args:
        apar: Set the anat parent dataset (nonoptional).
        dpar: Set the data parent dataset (nonoptional). dset may contain a\
            sub-brick selector, e.g., -dpar 'dset+orig[2,5,7]'.
        prefix: Set the prefix for the output dataset. Default is the prefix of\
            'dset'.
        dxyz: Set the grid spacing in the output dataset. Default is 1 mm.
        verbose: Print out progress reports.
        force: Write out result even if it means deleting an existing dataset.\
            Default is not to overwrite.
        resam: Set resampling mode for all sub-bricks. Modes: NN (Nearest\
            Neighbor), Li (Linear Interpolation), Cu (Cubic Interpolation), Bk\
            (Blocky Interpolation). Default is Li for all sub-bricks.
        thr: Set resampling mode for threshold sub-bricks. Modes: NN (Nearest\
            Neighbor), Li (Linear Interpolation), Cu (Cubic Interpolation), Bk\
            (Blocky Interpolation).
        func: Set resampling mode for functional sub-bricks. Modes: NN (Nearest\
            Neighbor), Li (Linear Interpolation), Cu (Cubic Interpolation), Bk\
            (Blocky Interpolation).
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `AdwarpOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(ADWARP_METADATA)
    cargs = []
    cargs.append("adwarp")
    cargs.extend([
        "-apar",
        execution.input_file(apar)
    ])
    cargs.extend([
        "-dpar",
        dpar
    ])
    if prefix is not None:
        cargs.extend([
            "-prefix",
            prefix
        ])
    if dxyz is not None:
        cargs.extend([
            "-dxyz",
            str(dxyz)
        ])
    if verbose:
        cargs.append("-verbose")
    if force:
        cargs.append("-force")
    if resam is not None:
        cargs.extend([
            "-resam",
            resam
        ])
    if thr is not None:
        cargs.extend([
            "-thr",
            thr
        ])
    if func is not None:
        cargs.extend([
            "-func",
            func
        ])
    ret = AdwarpOutputs(
        root=execution.output_file("."),
        header_output=execution.output_file(prefix + ".HEAD") if (prefix is not None) else None,
        brick_output=execution.output_file(prefix + ".BRIK") if (prefix is not None) else None,
    )
    execution.run(cargs)
    return ret


__all__ = [
    "ADWARP_METADATA",
    "AdwarpOutputs",
    "adwarp",
]
