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

import typing
import pathlib
from styxdefs import *
import dataclasses

XTRACT_STATS_METADATA = Metadata(
    id="f4e5e97bb4e53d159170f50f0562556e5349aa95.boutiques",
    name="xtract_stats",
    package="fsl",
    container_image_tag="mcin/fsl:6.0.5",
)


class XtractStatsOutputs(typing.NamedTuple):
    """
    Output object returned when calling `xtract_stats(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    csv_output: OutputPathType
    """CSV file containing the statistics from XTRACT analysis."""


def xtract_stats(
    folder_basename: str,
    xtract_dir: str,
    xtract2diff: str,
    runner: Runner | None = None,
) -> XtractStatsOutputs:
    """
    Quantitative evaluation tool of XTRACT results in neuroimaging.
    
    Author: Oxford Centre for Functional MRI of the Brain (FMRIB)
    
    URL: https://fsl.fmrib.ox.ac.uk/fsl/
    
    Args:
        folder_basename: Path to microstructure folder and basename of data\
            (e.g. /home/DTI/dti_).
        xtract_dir: Path to XTRACT output folder.
        xtract2diff: EITHER XTRACT results to diffusion space transform OR\
            'native' if tracts are already in diffusion space.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `XtractStatsOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(XTRACT_STATS_METADATA)
    cargs = []
    cargs.append("xtract_stats")
    cargs.append("-d")
    cargs.append(folder_basename)
    cargs.append("-xtract")
    cargs.append(xtract_dir)
    cargs.append("-w")
    cargs.append(xtract2diff)
    cargs.append("[reference]")
    cargs.append("[output_file]")
    cargs.append("[structures_file]")
    cargs.append("[threshold]")
    cargs.append("[measurements]")
    cargs.append("[keep_temp_files]")
    ret = XtractStatsOutputs(
        root=execution.output_file("."),
        csv_output=execution.output_file("<output_file>"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "XTRACT_STATS_METADATA",
    "XtractStatsOutputs",
    "xtract_stats",
]
