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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRI_MERGELABELS_METADATA = Metadata(
    id="6f1119002868794fb350ad4069f13562cf64aaa1.boutiques",
    name="mri_mergelabels",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class MriMergelabelsOutputs(typing.NamedTuple):
    """
    Output object returned when calling `mri_mergelabels(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    merged_label_file: OutputPathType
    """Merged label output file"""


def mri_mergelabels(
    input_labels: list[InputPathType],
    output_label: str,
    input_directory: str | None = None,
    runner: Runner | None = None,
) -> MriMergelabelsOutputs:
    """
    A tool to merge two or more label files by concatenating them together.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        input_labels: Input label files to be merged.
        output_label: Output file for the merged label.
        input_directory: Directory containing label files to be merged.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MriMergelabelsOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRI_MERGELABELS_METADATA)
    cargs = []
    cargs.append("mri_mergelabels")
    cargs.extend([
        "-i",
        *[execution.input_file(f) for f in input_labels]
    ])
    cargs.extend([
        "-o",
        output_label
    ])
    if input_directory is not None:
        cargs.extend([
            "-d",
            input_directory
        ])
    ret = MriMergelabelsOutputs(
        root=execution.output_file("."),
        merged_label_file=execution.output_file(output_label),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRI_MERGELABELS_METADATA",
    "MriMergelabelsOutputs",
    "mri_mergelabels",
]
