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

import typing
import pathlib
from styxdefs import *
import dataclasses

TBSS_SYM_METADATA = Metadata(
    id="e4be653286686df6b0a14dfb1d8ad1dfbc341908.boutiques",
    name="tbss_sym",
    package="fsl",
    container_image_tag="mcin/fsl:6.0.5",
)


class TbssSymOutputs(typing.NamedTuple):
    """
    Output object returned when calling `tbss_sym(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    skeleton_output: OutputPathType
    """Output skeleton image"""


def tbss_sym(
    input_image: InputPathType,
    alternative_4ddata: InputPathType | None = None,
    alternative_skeleton: InputPathType | None = None,
    output_image: InputPathType | None = None,
    help_flag: bool = False,
    debug_flag: bool = False,
    debug2_flag: InputPathType | None = None,
    runner: Runner | None = None,
) -> TbssSymOutputs:
    """
    TBSS Skeletonization tool from FSL.
    
    Author: University of Oxford (Stephen Smith)
    
    URL:
    https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/TBSS/UserGuide#Step_4:_tbss_skeleton
    
    Args:
        input_image: Input image.
        alternative_4ddata: Alternative 4D data (e.g., L1).
        alternative_skeleton: Alternative skeleton.
        output_image: Output skeleton image.
        help_flag: Display help message.
        debug_flag: Enable debugging image outputs.
        debug2_flag: De-project skelpoints points on skeleton back to all_FA\
            space.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `TbssSymOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(TBSS_SYM_METADATA)
    cargs = []
    cargs.append("tbss_skeleton")
    cargs.extend([
        "-i",
        execution.input_file(input_image)
    ])
    cargs.append("[SKEL_THRESHOLD]")
    cargs.append("[DISTANCE_MAP]")
    cargs.append("[SEARCH_RULE_MASK]")
    cargs.append("[4DDATA]")
    cargs.append("[PROJECTED_4DDATA]")
    if alternative_4ddata is not None:
        cargs.extend([
            "-a",
            execution.input_file(alternative_4ddata)
        ])
    if alternative_skeleton is not None:
        cargs.extend([
            "-s",
            execution.input_file(alternative_skeleton)
        ])
    if output_image is not None:
        cargs.extend([
            "-o",
            execution.input_file(output_image)
        ])
    if help_flag:
        cargs.append("-h")
    if debug_flag:
        cargs.append("-d")
    if debug2_flag is not None:
        cargs.extend([
            "-D",
            execution.input_file(debug2_flag)
        ])
    ret = TbssSymOutputs(
        root=execution.output_file("."),
        skeleton_output=execution.output_file("skeleton_output.nii.gz"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "TBSS_SYM_METADATA",
    "TbssSymOutputs",
    "tbss_sym",
]
