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

import typing
import pathlib
from styxdefs import *
import dataclasses

FSLSTATS_METADATA = Metadata(
    id="9c9462bb7a07c9f64854acdbb0dfee9186358c56.boutiques",
    name="fslstats",
    package="fsl",
    container_image_tag="mcin/fsl:6.0.5",
)


class FslstatsOutputs(typing.NamedTuple):
    """
    Output object returned when calling `fslstats(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_stats: OutputPathType
    """Statistics output file"""


def fslstats(
    input_file: InputPathType,
    runner: Runner | None = None,
) -> FslstatsOutputs:
    """
    FSL tool for calculating statistics on image data.
    
    Author: Oxford Centre for Functional MRI of the Brain (FMRIB)
    
    URL: https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/Fslutils
    
    Args:
        input_file: Input image file (e.g., image.nii.gz).
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `FslstatsOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(FSLSTATS_METADATA)
    cargs = []
    cargs.append("fslstats")
    cargs.append("[PREOPTIONS]")
    cargs.append(execution.input_file(input_file))
    cargs.append("[OPTIONS]")
    ret = FslstatsOutputs(
        root=execution.output_file("."),
        output_stats=execution.output_file(pathlib.Path(input_file).name + "_stats.txt"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "FSLSTATS_METADATA",
    "FslstatsOutputs",
    "fslstats",
]
