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

import typing
import pathlib
from styxdefs import *
import dataclasses

VOLUME_ALL_LABELS_TO_ROIS_METADATA = Metadata(
    id="0f6ea8b27a35d05248ce7cf9e5b3318c7359a543.boutiques",
    name="volume-all-labels-to-rois",
    package="workbench",
    container_image_tag="brainlife/connectome_workbench:1.5.0-freesurfer-update",
)


class VolumeAllLabelsToRoisOutputs(typing.NamedTuple):
    """
    Output object returned when calling `volume_all_labels_to_rois(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    volume_out: OutputPathType
    """the output volume file"""


def volume_all_labels_to_rois(
    label_in: InputPathType,
    map_: str,
    volume_out: str,
    runner: Runner | None = None,
) -> VolumeAllLabelsToRoisOutputs:
    """
    Make rois from all labels in a volume frame.
    
    The output volume has a frame for each label in the specified input frame,
    other than the ??? label, each of which contains an ROI of all voxels that
    are set to the corresponding label.
    
    Author: Washington University School of Medicin
    
    Args:
        label_in: the input volume label file.
        map_: the number or name of the label map to use.
        volume_out: the output volume file.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `VolumeAllLabelsToRoisOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(VOLUME_ALL_LABELS_TO_ROIS_METADATA)
    cargs = []
    cargs.append("wb_command")
    cargs.append("-volume-all-labels-to-rois")
    cargs.append(execution.input_file(label_in))
    cargs.append(map_)
    cargs.append(volume_out)
    ret = VolumeAllLabelsToRoisOutputs(
        root=execution.output_file("."),
        volume_out=execution.output_file(volume_out),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "VOLUME_ALL_LABELS_TO_ROIS_METADATA",
    "VolumeAllLabelsToRoisOutputs",
    "volume_all_labels_to_rois",
]
