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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRIS_SURFACE_TO_VOL_DISTANCES_METADATA = Metadata(
    id="b436cdee4792f571a6fb7c9b7311696958c3dc2d.boutiques",
    name="mris_surface_to_vol_distances",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class MrisSurfaceToVolDistancesOutputs(typing.NamedTuple):
    """
    Output object returned when calling `mris_surface_to_vol_distances(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_distances: OutputPathType
    """Output file containing surface-to-volume distances."""


def mris_surface_to_vol_distances(
    average_subject: str,
    hemisphere: str,
    subjects: list[str],
    output_prefix: str,
    runner: Runner | None = None,
) -> MrisSurfaceToVolDistancesOutputs:
    """
    Tool from FreeSurfer to calculate surface-to-volume distances.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        average_subject: The average subject.
        hemisphere: Hemisphere identifier (e.g., lh or rh).
        subjects: List of subjects for distance calculation.
        output_prefix: Prefix for output files.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MrisSurfaceToVolDistancesOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRIS_SURFACE_TO_VOL_DISTANCES_METADATA)
    cargs = []
    cargs.append("mris_surface_to_vol_distances")
    cargs.append(average_subject)
    cargs.append(hemisphere)
    cargs.extend(subjects)
    cargs.append(output_prefix)
    ret = MrisSurfaceToVolDistancesOutputs(
        root=execution.output_file("."),
        output_distances=execution.output_file(output_prefix + "_distances.txt"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRIS_SURFACE_TO_VOL_DISTANCES_METADATA",
    "MrisSurfaceToVolDistancesOutputs",
    "mris_surface_to_vol_distances",
]
