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

import typing
import pathlib
from styxdefs import *
import dataclasses

AUTO_WARP_PY_METADATA = Metadata(
    id="991ef18315e37d7887a5bb0048caaf474cfd252d.boutiques",
    name="auto_warp.py",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class AutoWarpPyOutputs(typing.NamedTuple):
    """
    Output object returned when calling `auto_warp_py(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""


def auto_warp_py(
    base: InputPathType,
    input_: InputPathType,
    skull_strip_input: bool = False,
    qblur: str | None = None,
    qworkhard: str | None = None,
    qw_opts: str | None = None,
    keep_rm_files: bool = False,
    prep_only: bool = False,
    help_: bool = False,
    hview: bool = False,
    limited_help: bool = False,
    option_help: bool = False,
    version: bool = False,
    ver: bool = False,
    verb: bool = False,
    save_script: bool = False,
    skip_affine: bool = False,
    skull_strip_base: bool = False,
    ex_mode: str | None = None,
    overwrite: bool = False,
    suffix: str | None = None,
    child_anat: str | None = None,
    warp_dxyz: float | None = None,
    affine_dxyz: float | None = None,
    affine_input_xmat: str | None = None,
    smooth_anat: bool = False,
    smooth_base: bool = False,
    unifize_input: bool = False,
    output_dir: str | None = None,
    followers: str | None = None,
    affine_followers_xmat: str | None = None,
    skullstrip_opts: str | None = None,
    at_opts: str | None = None,
    runner: Runner | None = None,
) -> AutoWarpPyOutputs:
    """
    Nonlinear registration tool.
    
    Author: AFNI Team
    
    URL: https://afni.nimh.nih.gov/pub/dist/doc/program_help/auto_warp.py.html
    
    Args:
        base: Name of reference or template volume.
        input_: Name of dataset to be registered.
        skull_strip_input: Do not skullstrip input dataset.
        qblur: Specify 3dQwarp blurs for base and source volumes.
        qworkhard: Set the two values for 3dQwarp's -workhard option.
        qw_opts: Pass all of OPTS as extra options directly to 3dQwarp.
        keep_rm_files: Don't delete any of the temporary files created.
        prep_only: Do preprocessing steps only without alignment.
        help_: Display help message.
        hview: Display help message in a text editor.
        limited_help: Display limited help message.
        option_help: Display help for all available options.
        version: Show version number and exit.
        ver: Show version number and exit.
        verb: Be verbose in messages and options.
        save_script: Save executed script in given file.
        skip_affine: Skip the affine registration process.
        skull_strip_base: Do not skullstrip base/template dataset.
        ex_mode: Command execution mode: quiet, echo, dry_run, script.
        overwrite: Overwrite existing files.
        suffix: Suffix to add to output files.
        child_anat: Names of child anatomical datasets.
        warp_dxyz: Resolution used for computing warp (cubic only).
        affine_dxyz: Resolution used for computing initial transform (cubic\
            only).
        affine_input_xmat: Affine transform to put input in standard space.\
            Special values are: 'AUTO' to use @auto_tlrc, 'ID' to do nothing,\
            'FILE.1D' for a pre-computed matrix FILE.1D.
        smooth_anat: Smooth anatomy before registration.
        smooth_base: Smooth template before registration.
        unifize_input: Unifize the input or not.
        output_dir: Set directory for output datasets.
        followers: Specify follower datasets.
        affine_followers_xmat: Specify follower datasets' affine transforms.
        skullstrip_opts: 3dSkullstrip miscellaneous options.
        at_opts: @auto_tlrc miscellaneous options.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `AutoWarpPyOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(AUTO_WARP_PY_METADATA)
    cargs = []
    cargs.append("auto_warp.py")
    cargs.append("-base")
    cargs.append(execution.input_file(base))
    cargs.append("-input")
    cargs.append(execution.input_file(input_))
    if skull_strip_input:
        cargs.append("-skull_strip_input")
    if qblur is not None:
        cargs.extend([
            "-qblur",
            qblur
        ])
    if qworkhard is not None:
        cargs.extend([
            "-qworkhard",
            qworkhard
        ])
    if qw_opts is not None:
        cargs.extend([
            "-qw_opts",
            qw_opts
        ])
    if keep_rm_files:
        cargs.append("-keep_rm_files")
    if prep_only:
        cargs.append("-prep_only")
    if help_:
        cargs.append("-help")
    if hview:
        cargs.append("-hview")
    if limited_help:
        cargs.append("-limited_help")
    if option_help:
        cargs.append("-option_help")
    if version:
        cargs.append("-version")
    if ver:
        cargs.append("-ver")
    if verb:
        cargs.append("-verb")
    if save_script:
        cargs.append("-save_script")
    if skip_affine:
        cargs.append("-skip_affine")
    if skull_strip_base:
        cargs.append("-skull_strip_base")
    if ex_mode is not None:
        cargs.extend([
            "-ex_mode",
            ex_mode
        ])
    if overwrite:
        cargs.append("-overwrite")
    if suffix is not None:
        cargs.extend([
            "-suffix",
            suffix
        ])
    if child_anat is not None:
        cargs.extend([
            "-child_anat",
            child_anat
        ])
    if warp_dxyz is not None:
        cargs.extend([
            "-warp_dxyz",
            str(warp_dxyz)
        ])
    if affine_dxyz is not None:
        cargs.extend([
            "-affine_dxyz",
            str(affine_dxyz)
        ])
    if affine_input_xmat is not None:
        cargs.extend([
            "-affine_input_xmat",
            affine_input_xmat
        ])
    if smooth_anat:
        cargs.append("-smooth_anat")
    if smooth_base:
        cargs.append("-smooth_base")
    if unifize_input:
        cargs.append("-unifize_input")
    if output_dir is not None:
        cargs.extend([
            "-output_dir",
            output_dir
        ])
    if followers is not None:
        cargs.extend([
            "-followers",
            followers
        ])
    if affine_followers_xmat is not None:
        cargs.extend([
            "-affine_followers_xmat",
            affine_followers_xmat
        ])
    if skullstrip_opts is not None:
        cargs.extend([
            "-skullstrip_opts",
            skullstrip_opts
        ])
    if at_opts is not None:
        cargs.extend([
            "-at_opts",
            at_opts
        ])
    ret = AutoWarpPyOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "AUTO_WARP_PY_METADATA",
    "AutoWarpPyOutputs",
    "auto_warp_py",
]
