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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRI_ANNOTATION2LABEL_METADATA = Metadata(
    id="90b6d8bcd55a8d08f2bccdf11454197b855e2864.boutiques",
    name="mri_annotation2label",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class MriAnnotation2labelOutputs(typing.NamedTuple):
    """
    Output object returned when calling `mri_annotation2label(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""


def mri_annotation2label(
    subject: str,
    hemi: str,
    lobes: InputPathType | None = None,
    lobes_strict: InputPathType | None = None,
    lobes_strict_phcg: InputPathType | None = None,
    label: float | None = None,
    labelbase: str | None = None,
    outdir: str | None = None,
    seg: InputPathType | None = None,
    segbase: float | None = None,
    ctab: InputPathType | None = None,
    border: InputPathType | None = None,
    border_annot: str | None = None,
    annotation: str | None = None,
    subjects_dir: str | None = None,
    surface: str | None = None,
    stat_: InputPathType | None = None,
    help_: bool = False,
    version: bool = False,
    runner: Runner | None = None,
) -> MriAnnotation2labelOutputs:
    """
    Convert an annotation into multiple label files or into a segmentation volume.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        subject: Source subject.
        hemi: Hemisphere (lh or rh) with surface.
        lobes: Create an annotation based on cortical lobes, saved to\
            <LobesFile>.
        lobes_strict: Use a stricter lobe definition with precentral added to\
            'frontal' and postcentral with 'parietal', saved to <LobesFile>.
        lobes_strict_phcg: Use a stricter lobe definition with an additional\
            lobe 'parahippocampalgyrus', saved to <LobesFile>.
        label: Extract only single label.
        labelbase: Output will be base-XXX.label.
        outdir: Output will be in dir/hemi.name.label.
        seg: Output will be a segmentation volume.
        segbase: Add base to the annotation number to get segmentation value.
        ctab: Color table, like FreeSurferColorLUT.txt.
        border: Output will be a binary overlay of the parc borders.
        border_annot: Default goes in subject/label.
        annotation: As found in SUBJDIR/labels <aparc>.
        subjects_dir: Specify SUBJECTS_DIR on the command line.
        surface: Name of surface <white>. Only affect xyz in label.
        stat_: Surface overlay file (curv or volume format).
        help_: Display help.
        version: Display version.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MriAnnotation2labelOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRI_ANNOTATION2LABEL_METADATA)
    cargs = []
    cargs.append("mri_annotation2label")
    cargs.extend([
        "--subject",
        subject
    ])
    cargs.extend([
        "--hemi",
        hemi
    ])
    if lobes is not None:
        cargs.extend([
            "--lobes",
            execution.input_file(lobes)
        ])
    if lobes_strict is not None:
        cargs.extend([
            "--lobesStrict",
            execution.input_file(lobes_strict)
        ])
    if lobes_strict_phcg is not None:
        cargs.extend([
            "--lobesStrictPHCG",
            execution.input_file(lobes_strict_phcg)
        ])
    if label is not None:
        cargs.extend([
            "--label",
            str(label)
        ])
    if labelbase is not None:
        cargs.extend([
            "--labelbase",
            labelbase
        ])
    if outdir is not None:
        cargs.extend([
            "--outdir",
            outdir
        ])
    if seg is not None:
        cargs.extend([
            "--seg",
            execution.input_file(seg)
        ])
    if segbase is not None:
        cargs.extend([
            "--segbase",
            str(segbase)
        ])
    if ctab is not None:
        cargs.extend([
            "--ctab",
            execution.input_file(ctab)
        ])
    if border is not None:
        cargs.extend([
            "--border",
            execution.input_file(border)
        ])
    if border_annot is not None:
        cargs.extend([
            "--border-annot",
            border_annot
        ])
    if annotation is not None:
        cargs.extend([
            "--annotation",
            annotation
        ])
    if subjects_dir is not None:
        cargs.extend([
            "--sd",
            subjects_dir
        ])
    if surface is not None:
        cargs.extend([
            "--surface",
            surface
        ])
    if stat_ is not None:
        cargs.extend([
            "--stat",
            execution.input_file(stat_)
        ])
    if help_:
        cargs.append("--help")
    if version:
        cargs.append("--version")
    ret = MriAnnotation2labelOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRI_ANNOTATION2LABEL_METADATA",
    "MriAnnotation2labelOutputs",
    "mri_annotation2label",
]
