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

import typing
import pathlib
from styxdefs import *
import dataclasses

VOLUME_LABEL_PROBABILITY_METADATA = Metadata(
    id="0eb4968bb2e8b9aea5b76afc92179fafd1396a41.boutiques",
    name="volume-label-probability",
    package="workbench",
    container_image_tag="brainlife/connectome_workbench:1.5.0-freesurfer-update",
)


class VolumeLabelProbabilityOutputs(typing.NamedTuple):
    """
    Output object returned when calling `volume_label_probability(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    probability_out: OutputPathType
    """the relative frequencies of each label at each voxel"""


def volume_label_probability(
    label_maps: InputPathType,
    probability_out: str,
    opt_exclude_unlabeled: bool = False,
    runner: Runner | None = None,
) -> VolumeLabelProbabilityOutputs:
    """
    Find frequency of volume labels.
    
    This command outputs a set of soft ROIs, one for each label in the input,
    where the value is how many of the input maps had that label at that voxel,
    divided by the number of input maps.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        label_maps: volume label file containing individual label maps from\
            many subjects.
        probability_out: the relative frequencies of each label at each voxel.
        opt_exclude_unlabeled: don't make a probability map of the unlabeled\
            key.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `VolumeLabelProbabilityOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(VOLUME_LABEL_PROBABILITY_METADATA)
    cargs = []
    cargs.append("wb_command")
    cargs.append("-volume-label-probability")
    cargs.append(execution.input_file(label_maps))
    cargs.append(probability_out)
    if opt_exclude_unlabeled:
        cargs.append("-exclude-unlabeled")
    ret = VolumeLabelProbabilityOutputs(
        root=execution.output_file("."),
        probability_out=execution.output_file(probability_out),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "VOLUME_LABEL_PROBABILITY_METADATA",
    "VolumeLabelProbabilityOutputs",
    "volume_label_probability",
]
