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

import typing
import pathlib
from styxdefs import *
import dataclasses

FABBER_QBOLD_METADATA = Metadata(
    id="790aded0ed85b0dafc8a88514179c6783ce215e6.boutiques",
    name="fabber_qbold",
    package="fsl",
    container_image_tag="mcin/fsl:6.0.5",
)


class FabberQboldOutputs(typing.NamedTuple):
    """
    Output object returned when calling `fabber_qbold(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    paramnames_file: OutputPathType
    """File containing the names of the model parameters"""
    model_fit_file: OutputPathType
    """4D volume of the model prediction"""
    residuals_file: OutputPathType
    """4D volume of the residuals"""
    model_extras_file: OutputPathType
    """Additional model-specific timeseries data"""
    mvn_file: OutputPathType
    """File containing the final MVN distributions"""
    mean_file: OutputPathType
    """File containing the parameter means"""
    std_file: OutputPathType
    """File containing the parameter standard deviations"""
    var_file: OutputPathType
    """File containing the parameter variances"""
    zstat_file: OutputPathType
    """File containing the parameter Zstats"""
    noise_mean_file: OutputPathType
    """File containing the noise means"""
    noise_std_file: OutputPathType
    """File containing the noise standard deviations"""
    free_energy_file: OutputPathType
    """File containing the free energy, if calculated"""
    logfile: OutputPathType
    """Logfile of the execution"""


def fabber_qbold(
    runner: Runner | None = None,
) -> FabberQboldOutputs:
    """
    Fabber - a flexible BaYesian modeling framework for FMRI and MRI analysis.
    
    Author: FSL
    
    URL: https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/Fabber
    
    Args:
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `FabberQboldOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(FABBER_QBOLD_METADATA)
    cargs = []
    cargs.append("fabber")
    cargs.append("[--listmethods]")
    cargs.append("[--listmodels]")
    cargs.append("[--listparams]")
    cargs.append("[--descparams]")
    cargs.append("[--listoutputs]")
    cargs.append("[--evaluate]")
    cargs.append("[--evaluate-params]")
    cargs.append("[--evaluate-nt]")
    cargs.append("[--simple-output]")
    cargs.append("[--output]")
    cargs.append("[--overwrite]")
    cargs.append("[--link-to-latest]")
    cargs.append("[--method]")
    cargs.append("[--model]")
    cargs.append("[--loadmodels]")
    cargs.append("[--data]")
    cargs.append("[--data<n>]")
    cargs.append("[--data-order]")
    cargs.append("[--mask]")
    cargs.append("[--mt<n>]")
    cargs.append("[--suppdata]")
    cargs.append("[--dump-param-names]")
    cargs.append("[--save-model-fit]")
    cargs.append("[--save-residuals]")
    cargs.append("[--save-model-extras]")
    cargs.append("[--save-mvn]")
    cargs.append("[--save-mean]")
    cargs.append("[--save-std]")
    cargs.append("[--save-var]")
    cargs.append("[--save-zstat]")
    cargs.append("[--save-noise-mean]")
    cargs.append("[--save-noise-std]")
    cargs.append("[--save-free-energy]")
    cargs.append("[--optfile]")
    cargs.append("[--debug]")
    ret = FabberQboldOutputs(
        root=execution.output_file("."),
        paramnames_file=execution.output_file("[OUTPUT_DIR]/paramnames.txt"),
        model_fit_file=execution.output_file("[OUTPUT_DIR]/model_fit.nii.gz"),
        residuals_file=execution.output_file("[OUTPUT_DIR]/residuals.nii.gz"),
        model_extras_file=execution.output_file("[OUTPUT_DIR]/model_extras.nii.gz"),
        mvn_file=execution.output_file("[OUTPUT_DIR]/mvn.nii.gz"),
        mean_file=execution.output_file("[OUTPUT_DIR]/mean.nii.gz"),
        std_file=execution.output_file("[OUTPUT_DIR]/std.nii.gz"),
        var_file=execution.output_file("[OUTPUT_DIR]/var.nii.gz"),
        zstat_file=execution.output_file("[OUTPUT_DIR]/zstat.nii.gz"),
        noise_mean_file=execution.output_file("[OUTPUT_DIR]/noise_mean.nii.gz"),
        noise_std_file=execution.output_file("[OUTPUT_DIR]/noise_std.nii.gz"),
        free_energy_file=execution.output_file("[OUTPUT_DIR]/free_energy.nii.gz"),
        logfile=execution.output_file("[OUTPUT_DIR]/logfile.txt"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "FABBER_QBOLD_METADATA",
    "FabberQboldOutputs",
    "fabber_qbold",
]
