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

import typing
import pathlib
from styxdefs import *
import dataclasses

FSLSELECTVOLS_METADATA = Metadata(
    id="dabd98132f6e29e1943e7c9b7d70ac37b409a5b6.boutiques",
    name="fslselectvols",
    package="fsl",
    container_image_tag="brainlife/fsl:6.0.4-patched2",
)


class FslselectvolsOutputs(typing.NamedTuple):
    """
    Output object returned when calling `fslselectvols(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_4d_image: OutputPathType
    """Output 4D image with selected volumes"""


def fslselectvols(
    input_file: InputPathType,
    output_file: str,
    vols_list: str,
    output_mean_flag: bool = False,
    output_variance_flag: bool = False,
    runner: Runner | None = None,
) -> FslselectvolsOutputs:
    """
    Select volumes from a 4D time series and output a subset 4D volume.
    
    Author: FMRIB Analysis Group, University of Oxford
    
    URL: https://fsl.fmrib.ox.ac.uk/fsl/fslwiki
    
    Args:
        input_file: Input file name (4D image).
        output_file: Output file name (4D image).
        vols_list: List of volumes to extract (comma-separated list or ascii\
            file).
        output_mean_flag: Output mean instead of concatenation.
        output_variance_flag: Output variance instead of concatenation.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `FslselectvolsOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(FSLSELECTVOLS_METADATA)
    cargs = []
    cargs.append("fslselectvols")
    cargs.extend([
        "-i",
        execution.input_file(input_file)
    ])
    cargs.extend([
        "-o",
        output_file
    ])
    cargs.extend([
        "--vols",
        vols_list
    ])
    if output_mean_flag:
        cargs.append("-m")
    if output_variance_flag:
        cargs.append("-v")
    ret = FslselectvolsOutputs(
        root=execution.output_file("."),
        output_4d_image=execution.output_file(output_file),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "FSLSELECTVOLS_METADATA",
    "FslselectvolsOutputs",
    "fslselectvols",
]
