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

import typing
import pathlib
from styxdefs import *
import dataclasses

CREATE_WARPED_GRID_IMAGE_METADATA = Metadata(
    id="43b75b2bbf1de43489ea85a551208078dcde662b.boutiques",
    name="CreateWarpedGridImage",
    package="ants",
    container_image_tag="antsx/ants:v2.5.3",
)


class CreateWarpedGridImageOutputs(typing.NamedTuple):
    """
    Output object returned when calling `create_warped_grid_image(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    warped_grid_image: OutputPathType
    """The resultant warped grid image."""


def create_warped_grid_image(
    image_dimension: int,
    deformation_field: InputPathType,
    output_image: str,
    directions: str | None = None,
    grid_spacing: str | None = None,
    grid_sigma: str | None = None,
    runner: Runner | None = None,
) -> CreateWarpedGridImageOutputs:
    """
    Create a warped grid image based on the specified deformation field.
    
    Author: ANTs Developers
    
    URL: https://github.com/ANTsX/ANTs
    
    Args:
        image_dimension: The dimensionality of the input image.
        deformation_field: File containing the deformation field to be applied.
        output_image: The filename of the output warped grid image.
        directions: Directions for the grid warping, e.g., '1x0x0'.
        grid_spacing: Spacing of the grid, e.g., '10x10x10'.
        grid_sigma: Sigma value for the grid smoothing, e.g., '1x1x1'.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `CreateWarpedGridImageOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(CREATE_WARPED_GRID_IMAGE_METADATA)
    cargs = []
    cargs.append("CreateWarpedGridImage")
    cargs.append(str(image_dimension))
    cargs.append(execution.input_file(deformation_field))
    cargs.append(output_image)
    if directions is not None:
        cargs.append(directions)
    if grid_spacing is not None:
        cargs.append(grid_spacing)
    if grid_sigma is not None:
        cargs.append(grid_sigma)
    ret = CreateWarpedGridImageOutputs(
        root=execution.output_file("."),
        warped_grid_image=execution.output_file(output_image),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "CREATE_WARPED_GRID_IMAGE_METADATA",
    "CreateWarpedGridImageOutputs",
    "create_warped_grid_image",
]
