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

import typing
import pathlib
from styxdefs import *
import dataclasses

SURF_LAYERS_METADATA = Metadata(
    id="604623c15444cbe34d0c899c05275654059b94ce.boutiques",
    name="SurfLayers",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class SurfLayersOutputs(typing.NamedTuple):
    """
    Output object returned when calling `surf_layers(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    interpolated_surfaces: OutputPathType | None
    """Interpolated surfaces files"""
    additional_spec_files: OutputPathType | None
    """Additional files if -spec option was used"""
    run_view_script: OutputPathType | None
    """Run script to view output directly"""


def surf_layers(
    spec_dset: InputPathType | None = None,
    outdir: str | None = None,
    states: str | None = None,
    hemi: str | None = None,
    n_intermed_surfs: float | None = None,
    surf_a: InputPathType | None = None,
    surf_b: InputPathType | None = None,
    surf_intermed_pref: str | None = None,
    echo: bool = False,
    no_clean: bool = False,
    runner: Runner | None = None,
) -> SurfLayersOutputs:
    """
    Compute intermediate equi-distant surfaces between two boundary surfaces.
    
    Author: AFNI Team
    
    URL: https://afni.nimh.nih.gov/pub/dist/doc/program_help/SurfLayers.html
    
    Args:
        spec_dset: Dataset that is the SUMA specification file describing input\
            surfaces.
        outdir: New directory for output (default: surflayers).
        states: Typically smoothwm, pial states to describe inner and outer\
            surfaces (default: 'smoothwm pial').
        hemi: Choose hemisphere: 'lh', 'rh', or 'lh rh' (for both).
        n_intermed_surfs: Total number of intermediate surfaces to create.
        surf_a: Inner boundary surface by filename (e.g., smoothwm.gii).
        surf_b: Outer boundary surface by filename (e.g., pial.gii).
        surf_intermed_pref: Name for interpolated surfaces (default: isurf).
        echo: Run script with 'set echo' (i.e., verbosely).
        no_clean: Do not remove temp files (probably just for testing).
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `SurfLayersOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(SURF_LAYERS_METADATA)
    cargs = []
    cargs.append("SurfLayers")
    if spec_dset is not None:
        cargs.extend([
            "-spec",
            execution.input_file(spec_dset)
        ])
    if outdir is not None:
        cargs.extend([
            "-outdir",
            outdir
        ])
    if states is not None:
        cargs.extend([
            "-states",
            states
        ])
    if hemi is not None:
        cargs.extend([
            "-hemi",
            hemi
        ])
    if n_intermed_surfs is not None:
        cargs.extend([
            "-n_intermed_surfs",
            str(n_intermed_surfs)
        ])
    if surf_a is not None:
        cargs.extend([
            "-surf_A",
            execution.input_file(surf_a)
        ])
    if surf_b is not None:
        cargs.extend([
            "-surf_B",
            execution.input_file(surf_b)
        ])
    if surf_intermed_pref is not None:
        cargs.extend([
            "-surf_intermed_pref",
            surf_intermed_pref
        ])
    if echo:
        cargs.append("-echo")
    if no_clean:
        cargs.append("-no_clean")
    ret = SurfLayersOutputs(
        root=execution.output_file("."),
        interpolated_surfaces=execution.output_file(outdir + "/isurf." + hemi + ".*.gii") if (outdir is not None and hemi is not None) else None,
        additional_spec_files=execution.output_file(outdir + "/*") if (outdir is not None) else None,
        run_view_script=execution.output_file(outdir + "/run*tcsh") if (outdir is not None) else None,
    )
    execution.run(cargs)
    return ret


__all__ = [
    "SURF_LAYERS_METADATA",
    "SurfLayersOutputs",
    "surf_layers",
]
