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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRIS_CA_LABEL_METADATA = Metadata(
    id="2f8449c959553824821e094d83f024564539a65c.boutiques",
    name="mris_ca_label",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class MrisCaLabelOutputs(typing.NamedTuple):
    """
    Output object returned when calling `mris_ca_label(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    labeled_surface: OutputPathType
    """Labeled cortical surface model"""


def mris_ca_label(
    subject: str,
    hemi: str,
    canonsurf: InputPathType,
    classifier: InputPathType,
    outputfile: str,
    seed: float | None = None,
    sdir: str | None = None,
    orig: str | None = None,
    long_flag: bool = False,
    r: InputPathType | None = None,
    novar_flag: bool = False,
    nbrs: float | None = None,
    f: float | None = None,
    t: InputPathType | None = None,
    p: str | None = None,
    v: float | None = None,
    w: str | None = None,
    help_flag: bool = False,
    version_flag: bool = False,
    runner: Runner | None = None,
) -> MrisCaLabelOutputs:
    """
    Produces an annotation file in which each cortical surface vertex is assigned a
    neuroanatomical label using a previously-prepared atlas file.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        subject: Subject ID for labeling.
        hemi: Hemisphere (rh or lh).
        canonsurf: Name of the spherical surface file that describes the\
            registration of a subject's vertices to the average surface.
        classifier: Specify classifier array input file.
        outputfile: Output annotated surface file listing the region label for\
            each vertex.
        seed: Specify the seed for the random number generator.
        sdir: Specify a subjects directory (default=$SUBJECTS_DIR).
        orig: Specify filename of original surface (default=smoothwm).
        long_flag: Refines the initial labeling read-in from -r (default:\
            disabled).
        r: File containing precomputed parcellation.
        novar_flag: Sets all covariance matrices to the identity (default:\
            disabled).
        nbrs: Neighborhood size (default=2).
        f: Applies mode filter <number> times before writing output\
            (default=10).
        t: Specify parcellation table input file (default: none).
        p: Output file containing label probability for each vertex.
        v: Diagnostic level (default=0).
        w: Writes-out snapshots of gibbs process every <number> iterations to\
            <filename> (default=disabled).
        help_flag: Print help information.
        version_flag: Print version information.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MrisCaLabelOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRIS_CA_LABEL_METADATA)
    cargs = []
    cargs.append("mris_ca_label")
    cargs.append(subject)
    cargs.append(hemi)
    cargs.append(execution.input_file(canonsurf))
    cargs.append(execution.input_file(classifier))
    cargs.append(outputfile)
    if seed is not None:
        cargs.extend([
            "-seed",
            str(seed)
        ])
    if sdir is not None:
        cargs.extend([
            "-sdir",
            sdir
        ])
    if orig is not None:
        cargs.extend([
            "-orig",
            orig
        ])
    if long_flag:
        cargs.append("-long")
    if r is not None:
        cargs.extend([
            "-r",
            execution.input_file(r)
        ])
    if novar_flag:
        cargs.append("-novar")
    if nbrs is not None:
        cargs.extend([
            "-nbrs",
            str(nbrs)
        ])
    if f is not None:
        cargs.extend([
            "-f",
            str(f)
        ])
    if t is not None:
        cargs.extend([
            "-t",
            execution.input_file(t)
        ])
    if p is not None:
        cargs.extend([
            "-p",
            p
        ])
    if v is not None:
        cargs.extend([
            "-v",
            str(v)
        ])
    if w is not None:
        cargs.extend([
            "-w",
            w
        ])
    if help_flag:
        cargs.append("--help")
    if version_flag:
        cargs.append("--version")
    ret = MrisCaLabelOutputs(
        root=execution.output_file("."),
        labeled_surface=execution.output_file(outputfile),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRIS_CA_LABEL_METADATA",
    "MrisCaLabelOutputs",
    "mris_ca_label",
]
