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

import typing
import pathlib
from styxdefs import *
import dataclasses

SUPER_RESOLUTION_METADATA = Metadata(
    id="971ff863d798c743fcbcf153281a68f737955b2e.boutiques",
    name="SuperResolution",
    package="ants",
    container_image_tag="antsx/ants:v2.5.3",
)


class SuperResolutionOutputs(typing.NamedTuple):
    """
    Output object returned when calling `super_resolution(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    super_resolved_image: OutputPathType
    """The output super-resolved image file."""


def super_resolution(
    image_dimension: int,
    output_image: InputPathType,
    domain_image: InputPathType,
    gradient_sigma: float,
    mesh_size: float,
    number_of_levels: int,
    input_image_files: list[InputPathType],
    runner: Runner | None = None,
) -> SuperResolutionOutputs:
    """
    The SuperResolution tool enhances the spatial resolution of input images. The
    'gradientSigma' parameter is used in calculating the gradient magnitude of the
    input images for weighting the voxel points during fitting. If a negative
    'gradient' sigma is specified then no weighting is used.
    
    Author: ANTs Developers
    
    URL: https://github.com/ANTsX/ANTs
    
    Args:
        image_dimension: Specifies the dimensionality of the input images\
            (e.g., 2 for 2D images, 3 for 3D images).
        output_image: The file path for the output super-resolved image.
        domain_image: The domain image is used as the template space for the\
            alignment of input images.
        gradient_sigma: The sigma used for calculating the gradient magnitude\
            of input images. If negative, no weighting is applied.
        mesh_size: The size of the mesh used in fitting.
        number_of_levels: The number of resolution levels to process.
        input_image_files: List of paths to input images to be processed for\
            super resolution.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `SuperResolutionOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(SUPER_RESOLUTION_METADATA)
    cargs = []
    cargs.append("SuperResolution")
    cargs.append(str(image_dimension))
    cargs.append(execution.input_file(output_image))
    cargs.append(execution.input_file(domain_image))
    cargs.append(str(gradient_sigma))
    cargs.append(str(mesh_size))
    cargs.append(str(number_of_levels))
    cargs.extend([execution.input_file(f) for f in input_image_files])
    ret = SuperResolutionOutputs(
        root=execution.output_file("."),
        super_resolved_image=execution.output_file(pathlib.Path(output_image).name),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "SUPER_RESOLUTION_METADATA",
    "SuperResolutionOutputs",
    "super_resolution",
]
