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

import typing
import pathlib
from styxdefs import *
import dataclasses

CIFTI_LABEL_PROBABILITY_METADATA = Metadata(
    id="fc29cc0dc8f5a8121f3307010f5444b65ec68ccc.boutiques",
    name="cifti-label-probability",
    package="workbench",
    container_image_tag="brainlife/connectome_workbench:1.5.0-freesurfer-update",
)


class CiftiLabelProbabilityOutputs(typing.NamedTuple):
    """
    Output object returned when calling `cifti_label_probability(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    probability_dscalar_out: OutputPathType
    """the relative frequencies of each label at each vertex/voxel"""


def cifti_label_probability(
    label_maps: InputPathType,
    probability_dscalar_out: str,
    opt_exclude_unlabeled: bool = False,
    runner: Runner | None = None,
) -> CiftiLabelProbabilityOutputs:
    """
    Find frequency of cifti 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
    vertex/voxel, divided by the number of input maps.
    
    Author: Washington University School of Medicin
    
    Args:
        label_maps: cifti dlabel file containing individual label maps from\
            many subjects.
        probability_dscalar_out: the relative frequencies of each label at each\
            vertex/voxel.
        opt_exclude_unlabeled: don't make a probability map of the unlabeled\
            key.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `CiftiLabelProbabilityOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(CIFTI_LABEL_PROBABILITY_METADATA)
    cargs = []
    cargs.append("wb_command")
    cargs.append("-cifti-label-probability")
    cargs.append(execution.input_file(label_maps))
    cargs.append(probability_dscalar_out)
    if opt_exclude_unlabeled:
        cargs.append("-exclude-unlabeled")
    ret = CiftiLabelProbabilityOutputs(
        root=execution.output_file("."),
        probability_dscalar_out=execution.output_file(probability_dscalar_out),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "CIFTI_LABEL_PROBABILITY_METADATA",
    "CiftiLabelProbabilityOutputs",
    "cifti_label_probability",
]
