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

import typing
import pathlib
from styxdefs import *
import dataclasses

APPLY_MORPH_METADATA = Metadata(
    id="a7cb7e420a1c51fbb13f7cd6c2a1a9581804bf02.boutiques",
    name="applyMorph",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


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


def apply_morph(
    inputs: list[InputPathType],
    template: InputPathType,
    transform: InputPathType,
    zlib_buffer: float | None = None,
    dbg_coords: list[float] | None = None,
    runner: Runner | None = None,
) -> ApplyMorphOutputs:
    """
    A tool for applying a morph to a volume using a template and a transform.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        inputs: Input files.
        template: Template volume.
        transform: Transform file.
        zlib_buffer: Zlib buffer pre-allocation multiplier.
        dbg_coords: Debugging coordinates.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `ApplyMorphOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(APPLY_MORPH_METADATA)
    cargs = []
    cargs.append("applyMorph")
    cargs.extend([execution.input_file(f) for f in inputs])
    cargs.extend([
        "--template",
        execution.input_file(template)
    ])
    cargs.extend([
        "--transform",
        execution.input_file(transform)
    ])
    if zlib_buffer is not None:
        cargs.extend([
            "--zlib_buffer",
            str(zlib_buffer)
        ])
    if dbg_coords is not None:
        cargs.extend([
            "--dbg_coords",
            *map(str, dbg_coords)
        ])
    ret = ApplyMorphOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "APPLY_MORPH_METADATA",
    "ApplyMorphOutputs",
    "apply_morph",
]
