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

import typing
import pathlib
from styxdefs import *
import dataclasses

SRATIO_METADATA = Metadata(
    id="b9e1c106ac7eb065c902d7e719b87ca6cd2c12c5.boutiques",
    name="sratio",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class SratioOutputs(typing.NamedTuple):
    """
    Output object returned when calling `sratio(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    sratio_result: OutputPathType
    """Result of the sratio operation"""


def sratio(
    value_a: float,
    value_b: float,
    abs_flag: bool = False,
    mask_threshold: float | None = None,
    runner: Runner | None = None,
) -> SratioOutputs:
    """
    Tool to compute ratio A/B if A>B, -B/A if B>A, with options for absolute
    computation and threshold masking.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        value_a: First value for the sratio operation.
        value_b: Second value for the sratio operation.
        abs_flag: Compute absolute value of both A and B before sratio.
        mask_threshold: Threshold based on max(abs(A),abs(B)) > thresh.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `SratioOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(SRATIO_METADATA)
    cargs = []
    cargs.append("sratio")
    cargs.append(str(value_a))
    cargs.append(str(value_b))
    if abs_flag:
        cargs.append("--abs")
    if mask_threshold is not None:
        cargs.extend([
            "--mask-thresh",
            str(mask_threshold)
        ])
    ret = SratioOutputs(
        root=execution.output_file("."),
        sratio_result=execution.output_file("[SRATIO_RESULT]"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "SRATIO_METADATA",
    "SratioOutputs",
    "sratio",
]
