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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRIS_CURVATURE_METADATA = Metadata(
    id="b2be5c74ffe0d5cc95cc6e6fc9fb27e6b3355ec4.boutiques",
    name="mris_curvature",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class MrisCurvatureOutputs(typing.NamedTuple):
    """
    Output object returned when calling `mris_curvature(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    mean_curvature: OutputPathType
    """Mean curvature file"""
    gaussian_curvature: OutputPathType
    """Gaussian curvature file"""


def mris_curvature(
    input_surface: InputPathType,
    save_curvature_files: bool = False,
    max_principal_curvature: bool = False,
    mgh_output_format: bool = False,
    min_principal_curvature: bool = False,
    iterative_averages: float | None = None,
    neighborhood_size: float | None = None,
    random_seed: float | None = None,
    curvatures: str | None = None,
    h_curvature: str | None = None,
    k_curvature: str | None = None,
    k1_curvature: str | None = None,
    k2_curvature: str | None = None,
    k1k2_curvature: str | None = None,
    runner: Runner | None = None,
) -> MrisCurvatureOutputs:
    """
    Compute the second fundamental form of a cortical surface to generate mean and
    Gaussian curvature.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        input_surface: Input surface file.
        save_curvature_files: Save curvature files (will only generate screen\
            output without this option).
        max_principal_curvature: Save 1st (max) principal curvature in\
            ?h.<surface>.max file.
        mgh_output_format: Save outputs in .mgz format.
        min_principal_curvature: Save 2nd (min) principal curvature in\
            ?h.<surface>.min file.
        iterative_averages: Perform <avgs> iterative averages of curvature\
            measure before saving.
        neighborhood_size: Set neighborhood size to nbrs.
        random_seed: Set random number generator to seed N.
        curvatures: Stand-alone option to save H (mean), K (gaussian), k1, and\
            k2 curvatures to stem.{curvname}.mgz.
        h_curvature: Stand-alone option to save H mean curvature to stem.H.mgz.
        k_curvature: Stand-alone option to save K gaussian curvature to\
            stem.K.mgz.
        k1_curvature: Stand-alone option to save k1 (primary principle)\
            curvature to stem.k1.mgz.
        k2_curvature: Stand-alone option to save k2 (secondary principle)\
            curvature to stem.k2.mgz.
        k1k2_curvature: Stand-alone option to save k1 and k2 curvature to\
            stem.{k1,k2}.mgz.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MrisCurvatureOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRIS_CURVATURE_METADATA)
    cargs = []
    cargs.append("mris_curvature")
    if save_curvature_files:
        cargs.append("-w")
    if max_principal_curvature:
        cargs.append("-max")
    if mgh_output_format:
        cargs.append("-mgh")
    if min_principal_curvature:
        cargs.append("-min")
    if iterative_averages is not None:
        cargs.extend([
            "-a",
            str(iterative_averages)
        ])
    if neighborhood_size is not None:
        cargs.extend([
            "-nbrs",
            str(neighborhood_size)
        ])
    if random_seed is not None:
        cargs.extend([
            "-seed",
            str(random_seed)
        ])
    if curvatures is not None:
        cargs.extend([
            "-curvs",
            curvatures
        ])
    if h_curvature is not None:
        cargs.extend([
            "-H",
            h_curvature
        ])
    if k_curvature is not None:
        cargs.extend([
            "-K",
            k_curvature
        ])
    if k1_curvature is not None:
        cargs.extend([
            "-k1",
            k1_curvature
        ])
    if k2_curvature is not None:
        cargs.extend([
            "-k2",
            k2_curvature
        ])
    if k1k2_curvature is not None:
        cargs.extend([
            "-k1k2",
            k1k2_curvature
        ])
    cargs.append(execution.input_file(input_surface))
    ret = MrisCurvatureOutputs(
        root=execution.output_file("."),
        mean_curvature=execution.output_file("<hemi>.<surface>.H"),
        gaussian_curvature=execution.output_file("<hemi>.<surface>.K"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRIS_CURVATURE_METADATA",
    "MrisCurvatureOutputs",
    "mris_curvature",
]
