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

import typing
import pathlib
from styxdefs import *
import dataclasses

CLUST_EXP_HIST_TABLE_PY_METADATA = Metadata(
    id="a706e0c184974ad6ed86360994f032d1d4e5296f.boutiques",
    name="ClustExp_HistTable.py",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class ClustExpHistTablePyOutputs(typing.NamedTuple):
    """
    Output object returned when calling `clust_exp_hist_table_py(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    group_table: OutputPathType | None
    """Table with information parsed from the statistics dataset history."""


def clust_exp_hist_table_py(
    stat_dset: InputPathType,
    prefix: str | None = None,
    session: str | None = None,
    overwrite: bool = False,
    runner: Runner | None = None,
) -> ClustExpHistTablePyOutputs:
    """
    Script to extract the data table from history of datasets from 3dttest++, 3dMVM,
    or 3dLME.
    
    Author: AFNI Developers
    
    URL: https://afni.nimh.nih.gov/
    
    Args:
        stat_dset: Statistics dataset.
        prefix: Name for output (no path). Default is GroupOut.
        session: Output parent folder if you don't want the current working\
            directory. Default is ./.
        overwrite: Remove previous folder with same PREFIX.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `ClustExpHistTablePyOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(CLUST_EXP_HIST_TABLE_PY_METADATA)
    cargs = []
    cargs.append("ClustExp_HistTable.py")
    cargs.extend([
        "-StatDSET",
        execution.input_file(stat_dset)
    ])
    if prefix is not None:
        cargs.extend([
            "-prefix",
            prefix
        ])
    if session is not None:
        cargs.extend([
            "-session",
            session
        ])
    if overwrite:
        cargs.append("-overwrite")
    ret = ClustExpHistTablePyOutputs(
        root=execution.output_file("."),
        group_table=execution.output_file(prefix + "_GroupTable.csv") if (prefix is not None) else None,
    )
    execution.run(cargs)
    return ret


__all__ = [
    "CLUST_EXP_HIST_TABLE_PY_METADATA",
    "ClustExpHistTablePyOutputs",
    "clust_exp_hist_table_py",
]
