# 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="12bb44f9721e85ea23d86fcfc727735d33f56b50.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 | None
    """1D output dataset."""


def roigrow(
    input_surface: str,
    roi_labels: str,
    lim_distance: float,
    output_prefix: str | None = None,
    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 Developers
    
    URL: https://afni.nimh.nih.gov/
    
    Args:
        input_surface: Specify input surface. You can also use -t* and -spec\
            and -surf methods to input surfaces.
        roi_labels: Data column containing integer labels of ROIs. Each integer\
            label gets grown separately.
        lim_distance: Distance to cover from each node. The units of LIM are\
            those of the surface's node coordinates. Distances are calculated along\
            the surface's mesh.
        output_prefix: Prefix of 1D output dataset. Default is ROIgrow.
        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.extend([
        "-i_TYPE",
        input_surface
    ])
    cargs.extend([
        "-roi_labels",
        roi_labels
    ])
    cargs.extend([
        "-lim",
        str(lim_distance)
    ])
    if output_prefix is not None:
        cargs.extend([
            "-prefix",
            output_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(output_prefix + ".1D") if (output_prefix is not None) else None,
    )
    execution.run(cargs)
    return ret


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