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

import typing
import pathlib
from styxdefs import *
import dataclasses

TBSS_NON_FA_METADATA = Metadata(
    id="42842b80c786bb821cbe4b3edd83c464130f2f3f.boutiques",
    name="tbss_non_FA",
    package="fsl",
    container_image_tag="mcin/fsl:6.0.5",
)


class TbssNonFaOutputs(typing.NamedTuple):
    """
    Output object returned when calling `tbss_non_fa(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    merged_output: OutputPathType
    """Merged output file"""


def tbss_non_fa(
    output_file: str,
    input_files: list[InputPathType],
    concat_auto: bool = False,
    concat_tr: float | None = 0,
    volume_number: float | None = None,
    runner: Runner | None = None,
) -> TbssNonFaOutputs:
    """
    TBSS processing for non-FA images.
    
    Author: FMRIB, Oxford Centre for Functional MRI of the Brain
    
    URL: https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/TBSS/UserGuide
    
    Args:
        output_file: Output file for merged images.
        input_files: Images to concatenate.
        concat_auto: Auto-choose: single slices -> volume, volumes -> 4D (time\
            series).
        concat_tr: Concatenate images in time and set the output image TR\
            (repetition time) to the final option value.
        volume_number: Only use volume <N> from each input file (first volume\
            is 0 not 1).
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `TbssNonFaOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(TBSS_NON_FA_METADATA)
    cargs = []
    cargs.append("fslmerge")
    if concat_auto:
        cargs.append("-a")
    cargs.append(output_file)
    cargs.extend([execution.input_file(f) for f in input_files])
    if concat_tr is not None:
        cargs.extend([
            "-tr",
            str(concat_tr)
        ])
    if volume_number is not None:
        cargs.extend([
            "-n",
            str(volume_number)
        ])
    ret = TbssNonFaOutputs(
        root=execution.output_file("."),
        merged_output=execution.output_file(output_file),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "TBSS_NON_FA_METADATA",
    "TbssNonFaOutputs",
    "tbss_non_fa",
]
