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

import typing
import pathlib
from styxdefs import *
import dataclasses

DMRI_MERGEPATHS_METADATA = Metadata(
    id="18bc644100dca612df1989666e60cf3a4214164c.boutiques",
    name="dmri_mergepaths",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class DmriMergepathsOutputs(typing.NamedTuple):
    """
    Output object returned when calling `dmri_mergepaths(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""


def dmri_mergepaths(
    input_volumes: list[InputPathType],
    output_volume: str,
    color_table: InputPathType,
    threshold: float,
    input_directory: str | None = None,
    debug: bool = False,
    check_opts: bool = False,
    runner: Runner | None = None,
) -> DmriMergepathsOutputs:
    """
    A tool for merging diffusion MRI path data.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        input_volumes: Input volume(s).
        output_volume: Output volume.
        color_table: Color table file.
        threshold: Lower threshold for display (0<=num<=1, as fraction of max).
        input_directory: Input directory (optional). If specified, names of\
            input files are relative to this.
        debug: Turn on debugging.
        check_opts: Don't run anything, just check options and exit.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `DmriMergepathsOutputs`).
    """
    if not (0 <= threshold <= 1): 
        raise ValueError(f"'threshold' must be between 0 <= x <= 1 but was {threshold}")
    runner = runner or get_global_runner()
    execution = runner.start_execution(DMRI_MERGEPATHS_METADATA)
    cargs = []
    cargs.append("./dmri_mergepaths")
    cargs.extend([execution.input_file(f) for f in input_volumes])
    if input_directory is not None:
        cargs.extend([
            "--indir",
            input_directory
        ])
    cargs.extend([
        "--out",
        output_volume
    ])
    cargs.extend([
        "--ctab",
        execution.input_file(color_table)
    ])
    cargs.extend([
        "--thresh",
        str(threshold)
    ])
    if debug:
        cargs.append("--debug")
    if check_opts:
        cargs.append("--checkopts")
    ret = DmriMergepathsOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "DMRI_MERGEPATHS_METADATA",
    "DmriMergepathsOutputs",
    "dmri_mergepaths",
]
