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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRIS_SPHERICAL_AVERAGE_METADATA = Metadata(
    id="1428559d3a56abaf727b5871834a354591593a62.boutiques",
    name="mris_spherical_average",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class MrisSphericalAverageOutputs(typing.NamedTuple):
    """
    Output object returned when calling `mris_spherical_average(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""


def mris_spherical_average(
    which: typing.Literal["coords", "label", "vals", "curv", "area"],
    fname: str,
    hemi: typing.Literal["lh", "rh"],
    spherical_surf: str,
    subjects: list[str],
    output: str,
    summary_statistics: str | None = None,
    runner: Runner | None = None,
) -> MrisSphericalAverageOutputs:
    """
    This tool adds a template into an average surface in FreeSurfer.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        which: Specifies the type, one of: coords, label, vals, curv, or area.
        fname: Input file name.
        hemi: Hemisphere: one of lh or rh.
        spherical_surf: The spherical surface file.
        subjects: List of subjects.
        output: Output file or directory.
        summary_statistics: Generate summary statistics and write them into\
            sigavg<cond #>-<hemi>.w and sigvar<cond #>-<hemi>.w.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MrisSphericalAverageOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRIS_SPHERICAL_AVERAGE_METADATA)
    cargs = []
    cargs.append("mris_spherical_average")
    if summary_statistics is not None:
        cargs.extend([
            "-s",
            summary_statistics
        ])
    cargs.append(which)
    cargs.append(fname)
    cargs.append(hemi)
    cargs.append(spherical_surf)
    cargs.extend(subjects)
    cargs.append(output)
    ret = MrisSphericalAverageOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRIS_SPHERICAL_AVERAGE_METADATA",
    "MrisSphericalAverageOutputs",
    "mris_spherical_average",
]
