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

import typing
import pathlib
from styxdefs import *
import dataclasses

CIFTI_LABEL_ADJACENCY_METADATA = Metadata(
    id="73b8f697c09de73b22005706eab881ce18e7cad1.boutiques",
    name="cifti-label-adjacency",
    package="workbench",
    container_image_tag="brainlife/connectome_workbench:1.5.0-freesurfer-update",
)


class CiftiLabelAdjacencyOutputs(typing.NamedTuple):
    """
    Output object returned when calling `cifti_label_adjacency(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    adjacency_out: OutputPathType
    """the output cifti pconn adjacency matrix"""


def cifti_label_adjacency(
    label_in: InputPathType,
    adjacency_out: str,
    opt_left_surface_surface: InputPathType | None = None,
    opt_right_surface_surface: InputPathType | None = None,
    opt_cerebellum_surface_surface: InputPathType | None = None,
    runner: Runner | None = None,
) -> CiftiLabelAdjacencyOutputs:
    """
    Make adjacency matrix of a cifti label file.
    
    Find face-adjacent voxels and connected vertices that have different label
    values, and count them for each pair. Put the resulting counts into a
    parcellated connectivity file, with the diagonal being zero. This gives a
    rough estimate of how long or expansive the border between two labels is.
    
    Author: Washington University School of Medicin
    
    Args:
        label_in: the input cifti label file.
        adjacency_out: the output cifti pconn adjacency matrix.
        opt_left_surface_surface: specify the left surface to use: the left\
            surface file.
        opt_right_surface_surface: specify the right surface to use: the right\
            surface file.
        opt_cerebellum_surface_surface: specify the cerebellum surface to use:\
            the cerebellum surface file.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `CiftiLabelAdjacencyOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(CIFTI_LABEL_ADJACENCY_METADATA)
    cargs = []
    cargs.append("wb_command")
    cargs.append("-cifti-label-adjacency")
    cargs.append(execution.input_file(label_in))
    cargs.append(adjacency_out)
    if opt_left_surface_surface is not None:
        cargs.extend([
            "-left-surface",
            execution.input_file(opt_left_surface_surface)
        ])
    if opt_right_surface_surface is not None:
        cargs.extend([
            "-right-surface",
            execution.input_file(opt_right_surface_surface)
        ])
    if opt_cerebellum_surface_surface is not None:
        cargs.extend([
            "-cerebellum-surface",
            execution.input_file(opt_cerebellum_surface_surface)
        ])
    ret = CiftiLabelAdjacencyOutputs(
        root=execution.output_file("."),
        adjacency_out=execution.output_file(adjacency_out),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "CIFTI_LABEL_ADJACENCY_METADATA",
    "CiftiLabelAdjacencyOutputs",
    "cifti_label_adjacency",
]
