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

import typing
import pathlib
from styxdefs import *
import dataclasses

CREATE_MORPH_METADATA = Metadata(
    id="27324e933d293e8e2b120cd3ed20c35684ee8e7e.boutiques",
    name="createMorph",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class CreateMorphOutputs(typing.NamedTuple):
    """
    Output object returned when calling `create_morph(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_transform_file: OutputPathType
    """The resulting output transform file in tm3d format."""


def create_morph(
    input_transforms: list[str],
    output_transform: InputPathType,
    template: InputPathType | None = None,
    subject: InputPathType | None = None,
    debug_coordinates: list[float] | None = None,
    runner: Runner | None = None,
) -> CreateMorphOutputs:
    """
    Tool to create morphological transformations using specified input transforms.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        input_transforms: Input transforms, must specify type (affine, volume,\
            morph, mesh, gcam) with filename.
        output_transform: Output transform file in tm3d format.
        template: Template volume for geometry. Required if a gcam is present.
        subject: Subject volume for geometry.
        debug_coordinates: Coordinates for debugging purposes. Requires three\
            integer values.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `CreateMorphOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(CREATE_MORPH_METADATA)
    cargs = []
    cargs.append("createMorph")
    cargs.extend([
        "--in",
        *input_transforms
    ])
    cargs.extend([
        "--out",
        execution.input_file(output_transform)
    ])
    if template is not None:
        cargs.extend([
            "--template",
            execution.input_file(template)
        ])
    if subject is not None:
        cargs.extend([
            "--subject",
            execution.input_file(subject)
        ])
    if debug_coordinates is not None:
        cargs.extend([
            "--dbg",
            *map(str, debug_coordinates)
        ])
    ret = CreateMorphOutputs(
        root=execution.output_file("."),
        output_transform_file=execution.output_file(pathlib.Path(output_transform).name),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "CREATE_MORPH_METADATA",
    "CreateMorphOutputs",
    "create_morph",
]
