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

import typing
import pathlib
from styxdefs import *
import dataclasses

COMPARE_SURFACES_METADATA = Metadata(
    id="5e9572f48ee61452099e956945950a7fda3d2d6f.boutiques",
    name="CompareSurfaces",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class CompareSurfacesOutputs(typing.NamedTuple):
    """
    Output object returned when calling `compare_surfaces(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    distance_output_file: OutputPathType | None
    """Distance output file."""
    color_output_file: OutputPathType | None
    """Node color output file."""


def compare_surfaces(
    spec_file: InputPathType,
    hemisphere: typing.Literal["L", "R"],
    volume_parent_1: InputPathType,
    volume_parent_2: InputPathType,
    file_prefix: str | None = None,
    one_node: float | None = None,
    node_range: list[float] | None = None,
    no_consistency_check: bool = False,
    no_volreg: bool = False,
    no_transform: bool = False,
    set_environment_variable: str | None = None,
    trace_: bool = False,
    extreme_trace: bool = False,
    no_memory_trace: bool = False,
    yes_memory_trace: bool = False,
    runner: Runner | None = None,
) -> CompareSurfacesOutputs:
    """
    Calculates distance at each node in Surface 1 (S1) to Surface 2 (S2) along the
    local surface normal at each node in S1. Superseded by SurfToSurf.
    
    Author: AFNI Team
    
    URL:
    https://afni.nimh.nih.gov/pub/dist/doc/program_help/CompareSurfaces.html
    
    Args:
        spec_file: File containing surface specification.
        hemisphere: Specify the hemisphere being processed (left or right).
        volume_parent_1: Volume parent BRIK for first surface.
        volume_parent_2: Volume parent BRIK for second surface.
        file_prefix: Prefix for distance and node color output files. Existing\
            file will not be overwritten.
        one_node: Output results for node index only. This option is for\
            debugging.
        node_range: Output results from node istart to node istop only. This\
            option is for debugging.
        no_consistency_check: Skip mesh orientation consistency check. This\
            speeds up the start time so it is useful for debugging runs.
        no_volreg: Ignore any Rotate, Volreg, Tagalign, or WarpDrive\
            transformations present in the Surface Volume.
        no_transform: Same as -novolreg.
        set_environment_variable: Set environment variable ENVname to be\
            ENVvalue. Quotes are necessary.
        trace_: Turns on In/Out debug and Memory tracing.
        extreme_trace: Turns on extreme tracing.
        no_memory_trace: Turn off memory tracing.
        yes_memory_trace: Turn on memory tracing (default).
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `CompareSurfacesOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(COMPARE_SURFACES_METADATA)
    cargs = []
    cargs.append("CompareSurfaces")
    cargs.extend([
        "-spec",
        execution.input_file(spec_file)
    ])
    cargs.extend([
        "-hemi",
        hemisphere
    ])
    cargs.extend([
        "-sv1",
        execution.input_file(volume_parent_1)
    ])
    cargs.extend([
        "-sv2",
        execution.input_file(volume_parent_2)
    ])
    if file_prefix is not None:
        cargs.extend([
            "-prefix",
            file_prefix
        ])
    if one_node is not None:
        cargs.extend([
            "-onenode",
            str(one_node)
        ])
    if node_range is not None:
        cargs.extend([
            "-noderange",
            *map(str, node_range)
        ])
    if no_consistency_check:
        cargs.append("-nocons")
    if no_volreg:
        cargs.append("-novolreg")
    if no_transform:
        cargs.append("-noxform")
    if set_environment_variable is not None:
        cargs.extend([
            "-setenv",
            set_environment_variable
        ])
    if trace_:
        cargs.append("-trace")
    if extreme_trace:
        cargs.append("-TRACE")
    if no_memory_trace:
        cargs.append("-nomall")
    if yes_memory_trace:
        cargs.append("-yesmall")
    ret = CompareSurfacesOutputs(
        root=execution.output_file("."),
        distance_output_file=execution.output_file(file_prefix + "_distance.txt") if (file_prefix is not None) else None,
        color_output_file=execution.output_file(file_prefix + "_color.txt") if (file_prefix is not None) else None,
    )
    execution.run(cargs)
    return ret


__all__ = [
    "COMPARE_SURFACES_METADATA",
    "CompareSurfacesOutputs",
    "compare_surfaces",
]
