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

import typing
import pathlib
from styxdefs import *
import dataclasses

BBLABEL_METADATA = Metadata(
    id="8029e18ce532d6970cd367d113a7d2298a390304.boutiques",
    name="bblabel",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class BblabelOutputs(typing.NamedTuple):
    """
    Output object returned when calling `bblabel(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_file: OutputPathType
    """Output file with the label points within the specified bounding box."""


def bblabel(
    labelfile: InputPathType,
    outlabelfile: str,
    xmin: float | None = None,
    xmax: float | None = None,
    ymin: float | None = None,
    ymax: float | None = None,
    zmin: float | None = None,
    zmax: float | None = None,
    debug: bool = False,
    umask: str | None = None,
    runner: Runner | None = None,
) -> BblabelOutputs:
    """
    Applies a bounding box to a label, copying only the label points within the
    specified box to the output.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        labelfile: Input label file.
        outlabelfile: Output label file.
        xmin: Minimum x-coordinate for bounding box.
        xmax: Maximum x-coordinate for bounding box.
        ymin: Minimum y-coordinate for bounding box.
        ymax: Maximum y-coordinate for bounding box.
        zmin: Minimum z-coordinate for bounding box.
        zmax: Maximum z-coordinate for bounding box.
        debug: Enable debug mode.
        umask: Set Unix file permission mask.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `BblabelOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(BBLABEL_METADATA)
    cargs = []
    cargs.append("bblabel")
    cargs.extend([
        "--l",
        execution.input_file(labelfile)
    ])
    if xmin is not None:
        cargs.extend([
            "--xmin",
            str(xmin)
        ])
    if xmax is not None:
        cargs.extend([
            "--xmax",
            str(xmax)
        ])
    if ymin is not None:
        cargs.extend([
            "--ymin",
            str(ymin)
        ])
    if ymax is not None:
        cargs.extend([
            "--ymax",
            str(ymax)
        ])
    if zmin is not None:
        cargs.extend([
            "--zmin",
            str(zmin)
        ])
    if zmax is not None:
        cargs.extend([
            "--zmax",
            str(zmax)
        ])
    cargs.extend([
        "--o",
        outlabelfile
    ])
    if debug:
        cargs.append("--debug")
    if umask is not None:
        cargs.extend([
            "--umask",
            umask
        ])
    ret = BblabelOutputs(
        root=execution.output_file("."),
        output_file=execution.output_file(outlabelfile),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "BBLABEL_METADATA",
    "BblabelOutputs",
    "bblabel",
]
