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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRIS_COMPUTE_LGI_METADATA = Metadata(
    id="336847c2bd9448a616f5ba616c1806f2492345d6.boutiques",
    name="mris_compute_lgi",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class MrisComputeLgiOutputs(typing.NamedTuple):
    """
    Output object returned when calling `mris_compute_lgi(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_surface_map: OutputPathType
    """Surface map file containing local gyrification measures"""


def mris_compute_lgi(
    input_surface: InputPathType,
    close_sphere_size: float | None = None,
    smooth_iters: float | None = None,
    step_size: float | None = None,
    echo: bool = False,
    dontrun: bool = False,
    runner: Runner | None = None,
) -> MrisComputeLgiOutputs:
    """
    Computes local measurements of gyrification at thousands of points over the
    entire cortical surface.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        input_surface: Input surface file, typically lh.pial or rh.pial.
        close_sphere_size: Use sphere of specified size in mm for morph closing\
            operation (default: 15mm).
        smooth_iters: Smooth outer-surface specified number of iterations\
            (default: 30).
        step_size: Skip every specified number of vertices when computing lGI\
            (default: 100).
        echo: Enable command echo, for debug.
        dontrun: Just show commands (don't run them).
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MrisComputeLgiOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRIS_COMPUTE_LGI_METADATA)
    cargs = []
    cargs.append("mris_compute_lgi")
    cargs.extend([
        "--i",
        execution.input_file(input_surface)
    ])
    if close_sphere_size is not None:
        cargs.extend([
            "--close_sphere_size",
            str(close_sphere_size)
        ])
    if smooth_iters is not None:
        cargs.extend([
            "--smooth_iters",
            str(smooth_iters)
        ])
    if step_size is not None:
        cargs.extend([
            "--step_size",
            str(step_size)
        ])
    if echo:
        cargs.append("--echo")
    if dontrun:
        cargs.append("--dontrun")
    ret = MrisComputeLgiOutputs(
        root=execution.output_file("."),
        output_surface_map=execution.output_file(pathlib.Path(input_surface).name + "_lgi"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRIS_COMPUTE_LGI_METADATA",
    "MrisComputeLgiOutputs",
    "mris_compute_lgi",
]
