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

import typing
import pathlib
from styxdefs import *
import dataclasses

ANTS_LANDMARK_BASED_TRANSFORM_INITIALIZER_METADATA = Metadata(
    id="e680d25c4b1661ea27d0968828f088b5d76779fa.boutiques",
    name="antsLandmarkBasedTransformInitializer",
    package="ants",
    container_image_tag="antsx/ants:v2.5.3",
)


class AntsLandmarkBasedTransformInitializerOutputs(typing.NamedTuple):
    """
    Output object returned when calling `ants_landmark_based_transform_initializer(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_transform: OutputPathType
    """The output file containing the initialized transform."""


def ants_landmark_based_transform_initializer(
    dimension: int,
    fixed_image: InputPathType,
    moving_image: InputPathType,
    transform_type: typing.Literal["rigid", "affine", "bspline"],
    output_transform: InputPathType,
    mesh_size: str | None = None,
    number_of_levels: int | None = None,
    order: int | None = None,
    enforce_stationary_boundaries: typing.Literal[0, 1] | None = None,
    landmark_weights: InputPathType | None = None,
    runner: Runner | None = None,
) -> AntsLandmarkBasedTransformInitializerOutputs:
    """
    This tool initializes a transform between two images based on corresponding
    landmarks.
    
    Author: ANTs Developers
    
    URL: https://github.com/ANTsX/ANTs
    
    Args:
        dimension: The dimensionality of the registration problem (e.g., 2 for\
            2D, 3 for 3D).
        fixed_image: The fixed image in the registration process.
        moving_image: The moving image in the registration process.
        transform_type: The type of transform to initialize. Options are\
            'rigid', 'affine', or 'bspline'.
        output_transform: The output transform file that will be created.
        mesh_size: The mesh size for the B-spline transform, specified as\
            'meshSize[0]xmeshSize[1]x...'. Default is '1x1x1'.
        number_of_levels: Number of levels for multi-resolution fitting.\
            Default is 4.
        order: The polynomial order of the B-spline transform. Default is 3.
        enforce_stationary_boundaries: Enforces stationary boundaries for the\
            B-spline transform. Default is 1 (true).
        landmark_weights: File containing landmark weights. Each row is either\
            'label,labelWeight' or 'labelWeight'.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `AntsLandmarkBasedTransformInitializerOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(ANTS_LANDMARK_BASED_TRANSFORM_INITIALIZER_METADATA)
    cargs = []
    cargs.append("antsLandmarkBasedTransformInitializer")
    cargs.append(str(dimension))
    cargs.append(execution.input_file(fixed_image))
    cargs.append(execution.input_file(moving_image))
    cargs.append(transform_type)
    cargs.append(execution.input_file(output_transform))
    if mesh_size is not None:
        cargs.append(mesh_size)
    if number_of_levels is not None:
        cargs.append(str(number_of_levels))
    if order is not None:
        cargs.append(str(order))
    if enforce_stationary_boundaries is not None:
        cargs.append(str(enforce_stationary_boundaries))
    if landmark_weights is not None:
        cargs.append(execution.input_file(landmark_weights))
    ret = AntsLandmarkBasedTransformInitializerOutputs(
        root=execution.output_file("."),
        output_transform=execution.output_file(pathlib.Path(output_transform).name),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "ANTS_LANDMARK_BASED_TRANSFORM_INITIALIZER_METADATA",
    "AntsLandmarkBasedTransformInitializerOutputs",
    "ants_landmark_based_transform_initializer",
]
