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

import typing
import pathlib
from styxdefs import *
import dataclasses

ROIGROW_METADATA = Metadata(
    id="23565f80bef0896060c03352b094c4ed57329a14.boutiques",
    name="ROIgrow",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class RoigrowOutputs(typing.NamedTuple):
    """
    Output object returned when calling `roigrow(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_file: OutputPathType
    """1D output dataset."""


def roigrow(
    full_list: bool = False,
    grow_from_edge: bool = False,
    insphere_diameter: float | None = None,
    inbox_edges: list[float] | None = None,
    runner: Runner | None = None,
) -> RoigrowOutputs:
    """
    A program to expand an ROI on the surface.
    
    Author: AFNI Team
    
    URL: https://afni.nimh.nih.gov/pub/dist/doc/program_help/ROIgrow.html
    
    Args:
        full_list: Output a row for each node on the surface. Nodes not in the\
            grown ROI, receive a 0 for a label. This option is ONLY for use with\
            -roi_labels.
        grow_from_edge: Grow ROIs from their edges rather than the brute force\
            default. This might make the program faster on large ROIs and large\
            surfaces.
        insphere_diameter: Diameter of the sphere inside which nodes are added\
            instead of growing along the surface.
        inbox_edges: Use a box of edge widths E1, E2, E3 instead of DIA.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `RoigrowOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(ROIGROW_METADATA)
    cargs = []
    cargs.append("ROIgrow")
    cargs.append("<-i_TYPE")
    cargs.append("SURF>")
    cargs.append("<-roi_labels")
    cargs.append("ROI_LABELS>")
    cargs.append("<-lim")
    cargs.append("LIM>")
    cargs.append("[-prefix")
    cargs.append("PREFIX]")
    if full_list:
        cargs.append("-full_list")
    if grow_from_edge:
        cargs.append("-grow_from_edge")
    if insphere_diameter is not None:
        cargs.extend([
            "-insphere",
            str(insphere_diameter)
        ])
    if inbox_edges is not None:
        cargs.extend([
            "-inbox",
            *map(str, inbox_edges)
        ])
    ret = RoigrowOutputs(
        root=execution.output_file("."),
        output_file=execution.output_file("[PREFIX].1D"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "ROIGROW_METADATA",
    "RoigrowOutputs",
    "roigrow",
]
