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

import typing
import pathlib
from styxdefs import *

SURFACE_INFLATION_METADATA = Metadata(
    id="8d8e7af8d80a5930fe793979c523d20e13520896.boutiques",
    name="surface-inflation",
    package="workbench",
    container_image_tag="brainlife/connectome_workbench:1.5.0-freesurfer-update",
)


SurfaceInflationParameters = typing.TypedDict('SurfaceInflationParameters', {
    "@type": typing.NotRequired[typing.Literal["workbench/surface-inflation"]],
    "anatomical_surface_in": InputPathType,
    "surface_in": InputPathType,
    "number_of_smoothing_cycles": int,
    "smoothing_strength": float,
    "smoothing_iterations": int,
    "inflation_factor": float,
    "surface_out": str,
})
SurfaceInflationParametersTagged = typing.TypedDict('SurfaceInflationParametersTagged', {
    "@type": typing.Literal["workbench/surface-inflation"],
    "anatomical_surface_in": InputPathType,
    "surface_in": InputPathType,
    "number_of_smoothing_cycles": int,
    "smoothing_strength": float,
    "smoothing_iterations": int,
    "inflation_factor": float,
    "surface_out": str,
})


class SurfaceInflationOutputs(typing.NamedTuple):
    """
    Output object returned when calling `SurfaceInflationParameters(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    surface_out: OutputPathType
    """output surface file"""


def surface_inflation_params(
    anatomical_surface_in: InputPathType,
    surface_in: InputPathType,
    number_of_smoothing_cycles: int,
    smoothing_strength: float,
    smoothing_iterations: int,
    inflation_factor: float,
    surface_out: str,
) -> SurfaceInflationParametersTagged:
    """
    Build parameters.
    
    Args:
        anatomical_surface_in: the anatomical surface.
        surface_in: the surface file to inflate.
        number_of_smoothing_cycles: number of smoothing cycles.
        smoothing_strength: smoothing strength (ranges [0.0 - 1.0]).
        smoothing_iterations: smoothing iterations.
        inflation_factor: inflation factor.
        surface_out: output surface file.
    Returns:
        Parameter dictionary
    """
    params = {
        "@type": "workbench/surface-inflation",
        "anatomical_surface_in": anatomical_surface_in,
        "surface_in": surface_in,
        "number_of_smoothing_cycles": number_of_smoothing_cycles,
        "smoothing_strength": smoothing_strength,
        "smoothing_iterations": smoothing_iterations,
        "inflation_factor": inflation_factor,
        "surface_out": surface_out,
    }
    return params


def surface_inflation_cargs(
    params: SurfaceInflationParameters,
    execution: Execution,
) -> list[str]:
    """
    Build command-line arguments from parameters.
    
    Args:
        params: The parameters.
        execution: The execution object for resolving input paths.
    Returns:
        Command-line arguments.
    """
    cargs = []
    cargs.append("wb_command")
    cargs.append("-surface-inflation")
    cargs.append(execution.input_file(params.get("anatomical_surface_in", None)))
    cargs.append(execution.input_file(params.get("surface_in", None)))
    cargs.append(str(params.get("number_of_smoothing_cycles", None)))
    cargs.append(str(params.get("smoothing_strength", None)))
    cargs.append(str(params.get("smoothing_iterations", None)))
    cargs.append(str(params.get("inflation_factor", None)))
    cargs.append(params.get("surface_out", None))
    return cargs


def surface_inflation_outputs(
    params: SurfaceInflationParameters,
    execution: Execution,
) -> SurfaceInflationOutputs:
    """
    Build outputs object containing output file paths and possibly stdout/stderr.
    
    Args:
        params: The parameters.
        execution: The execution object for resolving input paths.
    Returns:
        Outputs object.
    """
    ret = SurfaceInflationOutputs(
        root=execution.output_file("."),
        surface_out=execution.output_file(params.get("surface_out", None)),
    )
    return ret


def surface_inflation_execute(
    params: SurfaceInflationParameters,
    runner: Runner | None = None,
) -> SurfaceInflationOutputs:
    """
    surface-inflation
    
    Surface inflation.
    
    Inflate a surface by performing cycles that consist of smoothing followed by
    inflation (to correct shrinkage caused by smoothing).
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        params: The parameters.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `SurfaceInflationOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(SURFACE_INFLATION_METADATA)
    params = execution.params(params)
    cargs = surface_inflation_cargs(params, execution)
    ret = surface_inflation_outputs(params, execution)
    execution.run(cargs)
    return ret


def surface_inflation(
    anatomical_surface_in: InputPathType,
    surface_in: InputPathType,
    number_of_smoothing_cycles: int,
    smoothing_strength: float,
    smoothing_iterations: int,
    inflation_factor: float,
    surface_out: str,
    runner: Runner | None = None,
) -> SurfaceInflationOutputs:
    """
    surface-inflation
    
    Surface inflation.
    
    Inflate a surface by performing cycles that consist of smoothing followed by
    inflation (to correct shrinkage caused by smoothing).
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        anatomical_surface_in: the anatomical surface.
        surface_in: the surface file to inflate.
        number_of_smoothing_cycles: number of smoothing cycles.
        smoothing_strength: smoothing strength (ranges [0.0 - 1.0]).
        smoothing_iterations: smoothing iterations.
        inflation_factor: inflation factor.
        surface_out: output surface file.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `SurfaceInflationOutputs`).
    """
    params = surface_inflation_params(
        anatomical_surface_in=anatomical_surface_in,
        surface_in=surface_in,
        number_of_smoothing_cycles=number_of_smoothing_cycles,
        smoothing_strength=smoothing_strength,
        smoothing_iterations=smoothing_iterations,
        inflation_factor=inflation_factor,
        surface_out=surface_out,
    )
    return surface_inflation_execute(params, runner)


__all__ = [
    "SURFACE_INFLATION_METADATA",
    "SurfaceInflationOutputs",
    "surface_inflation",
    "surface_inflation_execute",
    "surface_inflation_params",
]
