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

import typing
import pathlib
from styxdefs import *
import dataclasses

V_3D_PVAL_METADATA = Metadata(
    id="728ce13fea332a59b9d1741e5383247954eba774.boutiques",
    name="3dPval",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class V3dPvalOutputs(typing.NamedTuple):
    """
    Output object returned when calling `v_3d_pval(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_file: OutputPathType | None
    """Output dataset with converted statistical values. Default output filename
    is 'Pval.nii.gz'."""


def v_3d_pval(
    input_dataset: InputPathType,
    zscore: bool = False,
    log2: bool = False,
    log10: bool = False,
    qval: bool = False,
    prefix: str | None = None,
    runner: Runner | None = None,
) -> V3dPvalOutputs:
    """
    Convert a dataset's statistical sub-bricks to p-values or other statistical
    representations.
    
    Author: AFNI Developers
    
    URL: https://afni.nimh.nih.gov/
    
    Args:
        input_dataset: Input dataset (e.g., InputDataset.nii).
        zscore: Convert statistic to a z-score instead, an N(0,1) deviate that\
            represents the same p-value.
        log2: Convert statistic to -log2(p).
        log10: Convert statistic to -log10(p).
        qval: Convert statistic to a q-value (FDR) instead. This option only\
            works with datasets that have FDR curves inserted in their headers.
        prefix: Prefix name for output file (default name is 'Pval').
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `V3dPvalOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(V_3D_PVAL_METADATA)
    cargs = []
    cargs.append("3dPval")
    cargs.append(execution.input_file(input_dataset))
    if zscore:
        cargs.append("-zscore")
    if log2:
        cargs.append("-log2")
    if log10:
        cargs.append("-log10")
    if qval:
        cargs.append("-qval")
    if prefix is not None:
        cargs.extend([
            "-prefix",
            prefix
        ])
    ret = V3dPvalOutputs(
        root=execution.output_file("."),
        output_file=execution.output_file(prefix + ".nii.gz") if (prefix is not None) else None,
    )
    execution.run(cargs)
    return ret


__all__ = [
    "V3dPvalOutputs",
    "V_3D_PVAL_METADATA",
    "v_3d_pval",
]
