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

import typing
import pathlib
from styxdefs import *
import dataclasses

HIST2PROB_METADATA = Metadata(
    id="5072c0a1058e5f776baf142ca06c38b53022df66.boutiques",
    name="hist2prob",
    package="fsl",
    container_image_tag="brainlife/fsl:6.0.4-patched2",
)


class Hist2probOutputs(typing.NamedTuple):
    """
    Output object returned when calling `hist2prob(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_probability_map: OutputPathType
    """Output probability map converted from histogram"""


def hist2prob(
    image: InputPathType,
    size: int,
    low_threshold: float,
    high_threshold: float,
    runner: Runner | None = None,
) -> Hist2probOutputs:
    """
    Converts a histogram image to a probability map based on specified thresholds.
    
    Author: FMRIB Analysis Group, University of Oxford
    
    URL: https://fsl.fmrib.ox.ac.uk/fsl/fslwiki
    
    Args:
        image: Input histogram image.
        size: Size of the histogram.
        low_threshold: Lower threshold for probability conversion.
        high_threshold: Higher threshold for probability conversion.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `Hist2probOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(HIST2PROB_METADATA)
    cargs = []
    cargs.append("hist2prob")
    cargs.append(execution.input_file(image))
    cargs.append(str(size))
    cargs.append(str(low_threshold))
    cargs.append(str(high_threshold))
    ret = Hist2probOutputs(
        root=execution.output_file("."),
        output_probability_map=execution.output_file(pathlib.Path(image).name + "_probability_map.nii.gz"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "HIST2PROB_METADATA",
    "Hist2probOutputs",
    "hist2prob",
]
