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

import typing
import pathlib
from styxdefs import *
import dataclasses

TBSS_DEPROJECT_METADATA = Metadata(
    id="fff73a1ba7bde8cd6f4413cf518933120619f762.boutiques",
    name="tbss_deproject",
    package="fsl",
    container_image_tag="brainlife/fsl:6.0.4-patched2",
)


class TbssDeprojectOutputs(typing.NamedTuple):
    """
    Output object returned when calling `tbss_deproject(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    stats_output: OutputPathType
    """Output in stats directory."""
    fa_output: OutputPathType
    """Output in FA directory."""


def tbss_deproject(
    skeleton_space_input_image: InputPathType,
    final_space_option: int,
    index_image_flag: bool = False,
    runner: Runner | None = None,
) -> TbssDeprojectOutputs:
    """
    Tool to deproject images from skeleton space to final space.
    
    Author: FMRIB Analysis Group, University of Oxford
    
    URL: https://fsl.fmrib.ox.ac.uk/fsl/fslwiki
    
    Args:
        skeleton_space_input_image: Skeleton space input image.
        final_space_option: Final space option.
        index_image_flag: Assume that the skeleton space input image contains\
            one or more integer index numbers and ensure that those exact values\
            are deprojected without being changed by interpolations.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `TbssDeprojectOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(TBSS_DEPROJECT_METADATA)
    cargs = []
    cargs.append("tbss_deproject")
    cargs.append(execution.input_file(skeleton_space_input_image))
    cargs.append(str(final_space_option))
    if index_image_flag:
        cargs.append("-n")
    ret = TbssDeprojectOutputs(
        root=execution.output_file("."),
        stats_output=execution.output_file("stats/" + pathlib.Path(skeleton_space_input_image).name),
        fa_output=execution.output_file("FA/" + pathlib.Path(skeleton_space_input_image).name),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "TBSS_DEPROJECT_METADATA",
    "TbssDeprojectOutputs",
    "tbss_deproject",
]
