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

import typing
import pathlib
from styxdefs import *
import dataclasses

LABELS_UNION_METADATA = Metadata(
    id="d5aa9c97375874b3bcbc62e4722154356911d0ad.boutiques",
    name="labels_union",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class LabelsUnionOutputs(typing.NamedTuple):
    """
    Output object returned when calling `labels_union(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    union_label: OutputPathType
    """Union of the two label files"""


def labels_union(
    label1: InputPathType,
    label2: InputPathType,
    outputname: str,
    runner: Runner | None = None,
) -> LabelsUnionOutputs:
    """
    Utility to create the union of two label files.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        label1: First label file (e.g., rh.BA3a.label).
        label2: Second label file (e.g., rh.BA3b.label).
        outputname: Output name for the union label file (e.g.,\
            rh.BA3ab.union.label).
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `LabelsUnionOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(LABELS_UNION_METADATA)
    cargs = []
    cargs.append("labels_union")
    cargs.append(execution.input_file(label1))
    cargs.append(execution.input_file(label2))
    cargs.append(outputname)
    ret = LabelsUnionOutputs(
        root=execution.output_file("."),
        union_label=execution.output_file(outputname),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "LABELS_UNION_METADATA",
    "LabelsUnionOutputs",
    "labels_union",
]
