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

import typing
import pathlib
from styxdefs import *
import dataclasses

PTOZ_METADATA = Metadata(
    id="83cf3188521a93de48419a7ce77e274ee8127ed5.boutiques",
    name="ptoz",
    package="fsl",
    container_image_tag="mcin/fsl:6.0.5",
)


class PtozOutputs(typing.NamedTuple):
    """
    Output object returned when calling `ptoz(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""


def ptoz(
    p_value: float,
    tail_flag: bool = False,
    grf_flag: float | None = None,
    runner: Runner | None = None,
) -> PtozOutputs:
    """
    Convert p-values to z-values.
    
    Author: Statistical Parametric Mapping (SPM)
    
    Args:
        p_value: p-value to convert.
        tail_flag: Use 2-tailed conversion.
        grf_flag: Use GRF maximum-height theory instead of Gaussian pdf.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `PtozOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(PTOZ_METADATA)
    cargs = []
    cargs.append("ptoz")
    cargs.append(str(p_value))
    if tail_flag:
        cargs.append("-2")
    if grf_flag is not None:
        cargs.extend([
            "-g",
            str(grf_flag)
        ])
    ret = PtozOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "PTOZ_METADATA",
    "PtozOutputs",
    "ptoz",
]
