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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRIS_DIVIDE_PARCELLATION_METADATA = Metadata(
    id="973cad6ea7ea439576bea5f4ba09e31fd5af1401.boutiques",
    name="mris_divide_parcellation",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class MrisDivideParcellationOutputs(typing.NamedTuple):
    """
    Output object returned when calling `mris_divide_parcellation(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    outannot_file: OutputPathType
    """The resulting annotation file with divided labels."""


def mris_divide_parcellation(
    subject: str,
    hemi: str,
    sourceannot: InputPathType,
    splitfile_or_areathresh: str,
    outannot: str,
    scale: float | None = None,
    label_name: str | None = None,
    runner: Runner | None = None,
) -> MrisDivideParcellationOutputs:
    """
    Divides one or more parcellations into divisions perpendicular to the long axis
    of the label.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        subject: The subject identifier.
        hemi: The hemisphere identifier, e.g., left (lh) or right (rh).
        sourceannot: The source annotation file.
        splitfile_or_areathresh: Either a splitfile specifying divisions or an\
            area threshold in mm^2.
        outannot: The output annotation file name.
        scale: Specify offset scaling for rgb values (default=20).
        label_name: Only process the label <label name> (not implemented yet).
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MrisDivideParcellationOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRIS_DIVIDE_PARCELLATION_METADATA)
    cargs = []
    cargs.append("mris_divide_parcellation")
    cargs.append(subject)
    cargs.append(hemi)
    cargs.append(execution.input_file(sourceannot))
    cargs.append(splitfile_or_areathresh)
    cargs.append(outannot)
    if scale is not None:
        cargs.extend([
            "-scale",
            str(scale)
        ])
    if label_name is not None:
        cargs.extend([
            "-l",
            label_name
        ])
    ret = MrisDivideParcellationOutputs(
        root=execution.output_file("."),
        outannot_file=execution.output_file(outannot),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRIS_DIVIDE_PARCELLATION_METADATA",
    "MrisDivideParcellationOutputs",
    "mris_divide_parcellation",
]
