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

import typing
import pathlib
from styxdefs import *
import dataclasses

LABEL_ERODE_METADATA = Metadata(
    id="d61ae2acb345083e76990bfa8a4104ae10b7c74b.boutiques",
    name="label-erode",
    package="workbench",
    container_image_tag="brainlife/connectome_workbench:1.5.0-freesurfer-update",
)


class LabelErodeOutputs(typing.NamedTuple):
    """
    Output object returned when calling `label_erode(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    label_out: OutputPathType
    """the output label file"""


def label_erode(
    label: InputPathType,
    surface: InputPathType,
    erode_dist: float,
    label_out: str,
    opt_roi_roi_metric: InputPathType | None = None,
    opt_column_column: str | None = None,
    opt_corrected_areas_area_metric: InputPathType | None = None,
    runner: Runner | None = None,
) -> LabelErodeOutputs:
    """
    Erode a label file.
    
    Around each vertex that is unlabeled, set surrounding vertices to unlabeled.
    The surrounding vertices are all immediate neighbors and all vertices within
    the specified distance.
    
    Note that the -corrected-areas option uses an approximate correction for
    distance along the surface.
    
    Author: Connectome Workbench Developers
    
    URL: https://github.com/Washington-University/workbench
    
    Args:
        label: the input label.
        surface: the surface to erode on.
        erode_dist: distance in mm to erode the labels.
        label_out: the output label file.
        opt_roi_roi_metric: assume values outside this roi are labeled: metric\
            file, positive values denote vertices that have data.
        opt_column_column: select a single column to erode: the column number\
            or name.
        opt_corrected_areas_area_metric: vertex areas to use instead of\
            computing them from the surface: the corrected vertex areas, as a\
            metric.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `LabelErodeOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(LABEL_ERODE_METADATA)
    cargs = []
    cargs.append("wb_command")
    cargs.append("-label-erode")
    cargs.append(execution.input_file(label))
    cargs.append(execution.input_file(surface))
    cargs.append(str(erode_dist))
    cargs.append(label_out)
    if opt_roi_roi_metric is not None:
        cargs.extend([
            "-roi",
            execution.input_file(opt_roi_roi_metric)
        ])
    if opt_column_column is not None:
        cargs.extend([
            "-column",
            opt_column_column
        ])
    if opt_corrected_areas_area_metric is not None:
        cargs.extend([
            "-corrected-areas",
            execution.input_file(opt_corrected_areas_area_metric)
        ])
    ret = LabelErodeOutputs(
        root=execution.output_file("."),
        label_out=execution.output_file(label_out),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "LABEL_ERODE_METADATA",
    "LabelErodeOutputs",
    "label_erode",
]
