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

import typing
import pathlib
from styxdefs import *
import dataclasses

CIFTI_CREATE_LABEL_METADATA = Metadata(
    id="2de4152aa98a5a2ba317600135a0292a6a69deee.boutiques",
    name="cifti-create-label",
    package="workbench",
    container_image_tag="brainlife/connectome_workbench:1.5.0-freesurfer-update",
)


@dataclasses.dataclass
class CiftiCreateLabelVolume:
    """
    volume component.
    """
    label_volume: InputPathType
    """label volume file containing the data to be copied"""
    structure_label_volume: InputPathType
    """label volume file that defines which voxels to use"""
    
    def run(
        self,
        execution: Execution,
    ) -> list[str]:
        """
        Build command line arguments. This method is called by the main command.
        
        Args:
            execution: The execution object.
        Returns:
            Command line arguments
        """
        cargs = []
        cargs.append("-volume")
        cargs.append(execution.input_file(self.label_volume))
        cargs.append(execution.input_file(self.structure_label_volume))
        return cargs


@dataclasses.dataclass
class CiftiCreateLabelLeftLabel:
    """
    label file for left surface.
    """
    label: InputPathType
    """the label file"""
    opt_roi_left_roi_metric: InputPathType | None = None
    """roi of vertices to use from left surface: the ROI as a metric file"""
    
    def run(
        self,
        execution: Execution,
    ) -> list[str]:
        """
        Build command line arguments. This method is called by the main command.
        
        Args:
            execution: The execution object.
        Returns:
            Command line arguments
        """
        cargs = []
        cargs.append("-left-label")
        cargs.append(execution.input_file(self.label))
        if self.opt_roi_left_roi_metric is not None:
            cargs.extend([
                "-roi-left",
                execution.input_file(self.opt_roi_left_roi_metric)
            ])
        return cargs


@dataclasses.dataclass
class CiftiCreateLabelRightLabel:
    """
    label for left surface.
    """
    label: InputPathType
    """the label file"""
    opt_roi_right_roi_metric: InputPathType | None = None
    """roi of vertices to use from right surface: the ROI as a metric file"""
    
    def run(
        self,
        execution: Execution,
    ) -> list[str]:
        """
        Build command line arguments. This method is called by the main command.
        
        Args:
            execution: The execution object.
        Returns:
            Command line arguments
        """
        cargs = []
        cargs.append("-right-label")
        cargs.append(execution.input_file(self.label))
        if self.opt_roi_right_roi_metric is not None:
            cargs.extend([
                "-roi-right",
                execution.input_file(self.opt_roi_right_roi_metric)
            ])
        return cargs


@dataclasses.dataclass
class CiftiCreateLabelCerebellumLabel:
    """
    label for the cerebellum.
    """
    label: InputPathType
    """the label file"""
    opt_roi_cerebellum_roi_metric: InputPathType | None = None
    """roi of vertices to use from right surface: the ROI as a metric file"""
    
    def run(
        self,
        execution: Execution,
    ) -> list[str]:
        """
        Build command line arguments. This method is called by the main command.
        
        Args:
            execution: The execution object.
        Returns:
            Command line arguments
        """
        cargs = []
        cargs.append("-cerebellum-label")
        cargs.append(execution.input_file(self.label))
        if self.opt_roi_cerebellum_roi_metric is not None:
            cargs.extend([
                "-roi-cerebellum",
                execution.input_file(self.opt_roi_cerebellum_roi_metric)
            ])
        return cargs


class CiftiCreateLabelOutputs(typing.NamedTuple):
    """
    Output object returned when calling `cifti_create_label(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    cifti_out: OutputPathType
    """the output cifti file"""


def cifti_create_label(
    cifti_out: str,
    volume: CiftiCreateLabelVolume | None = None,
    left_label: CiftiCreateLabelLeftLabel | None = None,
    right_label: CiftiCreateLabelRightLabel | None = None,
    cerebellum_label: CiftiCreateLabelCerebellumLabel | None = None,
    runner: Runner | None = None,
) -> CiftiCreateLabelOutputs:
    """
    Create a cifti label file.
    
    All input files must have the same number of columns/subvolumes. Only the
    specified components will be in the output cifti. At least one component
    must be specified.
    
    The -volume option requires two volume arguments, the label-volume argument
    contains all labels you want to display (e.g. nuclei of the thalamus),
    whereas the structure-label-volume argument contains all CIFTI voxel-based
    structures you want to include data within (e.g. THALAMUS_LEFT,
    THALAMUS_RIGHT, etc). See -volume-label-import and -volume-help for format
    details of label volume files. If you just want the labels in voxels to be
    the structure names, you may use the same file for both arguments. The
    structure-label-volume must use some of the label names from this list, all
    other label names in the structure-label-volume will be ignored:
    
    CORTEX_LEFT
    CORTEX_RIGHT
    CEREBELLUM
    ACCUMBENS_LEFT
    ACCUMBENS_RIGHT
    ALL_GREY_MATTER
    ALL_WHITE_MATTER
    AMYGDALA_LEFT
    AMYGDALA_RIGHT
    BRAIN_STEM
    CAUDATE_LEFT
    CAUDATE_RIGHT
    CEREBELLAR_WHITE_MATTER_LEFT
    CEREBELLAR_WHITE_MATTER_RIGHT
    CEREBELLUM_LEFT
    CEREBELLUM_RIGHT
    CEREBRAL_WHITE_MATTER_LEFT
    CEREBRAL_WHITE_MATTER_RIGHT
    CORTEX
    DIENCEPHALON_VENTRAL_LEFT
    DIENCEPHALON_VENTRAL_RIGHT
    HIPPOCAMPUS_LEFT
    HIPPOCAMPUS_RIGHT
    INVALID
    OTHER
    OTHER_GREY_MATTER
    OTHER_WHITE_MATTER
    PALLIDUM_LEFT
    PALLIDUM_RIGHT
    PUTAMEN_LEFT
    PUTAMEN_RIGHT
    THALAMUS_LEFT
    THALAMUS_RIGHT.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        cifti_out: the output cifti file.
        volume: volume component.
        left_label: label file for left surface.
        right_label: label for left surface.
        cerebellum_label: label for the cerebellum.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `CiftiCreateLabelOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(CIFTI_CREATE_LABEL_METADATA)
    cargs = []
    cargs.append("wb_command")
    cargs.append("-cifti-create-label")
    cargs.append(cifti_out)
    if volume is not None:
        cargs.extend(volume.run(execution))
    if left_label is not None:
        cargs.extend(left_label.run(execution))
    if right_label is not None:
        cargs.extend(right_label.run(execution))
    if cerebellum_label is not None:
        cargs.extend(cerebellum_label.run(execution))
    ret = CiftiCreateLabelOutputs(
        root=execution.output_file("."),
        cifti_out=execution.output_file(cifti_out),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "CIFTI_CREATE_LABEL_METADATA",
    "CiftiCreateLabelCerebellumLabel",
    "CiftiCreateLabelLeftLabel",
    "CiftiCreateLabelOutputs",
    "CiftiCreateLabelRightLabel",
    "CiftiCreateLabelVolume",
    "cifti_create_label",
]
