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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRIS_CA_TRAIN_METADATA = Metadata(
    id="8e70a6159e0a5ec42aaae4b7bcd8282432b8dd18.boutiques",
    name="mris_ca_train",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class MrisCaTrainOutputs(typing.NamedTuple):
    """
    Output object returned when calling `mris_ca_train(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_file: OutputPathType
    """Classifier array output file generated by mris_ca_train"""


def mris_ca_train(
    hemi: str,
    canonsurf: InputPathType,
    annot_file: InputPathType,
    subjects: list[str],
    output_file: str,
    sdir: str | None = None,
    nbrs: float | None = None,
    orig: InputPathType | None = None,
    norm1: bool = False,
    norm2: bool = False,
    norm3: bool = False,
    ic: str | None = None,
    sulc: bool = False,
    sulconly: bool = False,
    a: float | None = None,
    parcellation_table: InputPathType | None = None,
    n: float | None = None,
    verbose: float | None = None,
    debug_vertex: float | None = None,
    gcs_means: str | None = None,
    gcs_priors: str | None = None,
    gcs_diff: str | None = None,
    nfill: float | None = None,
    no_fill: bool = False,
    help_: bool = False,
    version: bool = False,
    runner: Runner | None = None,
) -> MrisCaTrainOutputs:
    """
    Creates a cortical parcellation atlas file based on one or more annotated
    subjects using probabilistic information.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        hemi: Hemisphere: rh or lh.
        canonsurf: Canonical surface filename.
        annot_file: Annotation filename.
        subjects: List of subject ids.
        output_file: Classifier array output file.
        sdir: Directory as subjects directory (default: $SUBJECTS_DIR).
        nbrs: Neighborhood size (default=2).
        orig: Filename of original surface (default=smoothwm).
        norm1: GCSA normalize input #1 after reading (default: disabled).
        norm2: GCSA normalize input #2 after reading (default: disabled).
        norm3: GCSA normalize input #3 after reading (default: disabled).
        ic: Parameters passed to the classifier routine (default: -ic 7 4).
        sulc: Specify sulc as only input (default: sulcus and curvature).
        sulconly: Same as -sulc.
        a: Number of nearest neighbor smoothing iterations to apply to input 1\
            (default=5).
        parcellation_table: Parcellation table input file (default: none).
        n: Number of inputs (default=1,max=3).
        verbose: Diagnostic level (default=0).
        debug_vertex: Debug diagnostic level for a specific vertex (default=0).
        gcs_means: Extract likelihood means for all classes for given input.
        gcs_priors: Extract priors for all classes for given input.
        gcs_diff: Determine whether GCSAs are different.
        nfill: Set the max number of iterations for filling empty vertices.
        no_fill: Do not fill at all.
        help_: Print help info.
        version: Print version info.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MrisCaTrainOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRIS_CA_TRAIN_METADATA)
    cargs = []
    cargs.append("mris_ca_train")
    cargs.append(hemi)
    cargs.append(execution.input_file(canonsurf))
    cargs.append(execution.input_file(annot_file))
    cargs.extend(subjects)
    cargs.append(output_file)
    if sdir is not None:
        cargs.extend([
            "-sdir",
            sdir
        ])
    if nbrs is not None:
        cargs.extend([
            "-nbrs",
            str(nbrs)
        ])
    if orig is not None:
        cargs.extend([
            "-orig",
            execution.input_file(orig)
        ])
    if norm1:
        cargs.append("-norm1")
    if norm2:
        cargs.append("-norm2")
    if norm3:
        cargs.append("-norm3")
    if ic is not None:
        cargs.extend([
            "-ic",
            ic
        ])
    if sulc:
        cargs.append("-sulc")
    if sulconly:
        cargs.append("-sulconly")
    if a is not None:
        cargs.extend([
            "-a",
            str(a)
        ])
    if parcellation_table is not None:
        cargs.extend([
            "-t",
            execution.input_file(parcellation_table)
        ])
    if n is not None:
        cargs.extend([
            "-n",
            str(n)
        ])
    if verbose is not None:
        cargs.extend([
            "-v",
            str(verbose)
        ])
    if debug_vertex is not None:
        cargs.extend([
            "-debug-vertex",
            str(debug_vertex)
        ])
    if gcs_means is not None:
        cargs.extend([
            "-gcs-means",
            gcs_means
        ])
    if gcs_priors is not None:
        cargs.extend([
            "-gcs-priors",
            gcs_priors
        ])
    if gcs_diff is not None:
        cargs.extend([
            "-gcs-diff",
            gcs_diff
        ])
    if nfill is not None:
        cargs.extend([
            "-nfill",
            str(nfill)
        ])
    if no_fill:
        cargs.append("-no-fill")
    if help_:
        cargs.append("--help")
    if version:
        cargs.append("--version")
    ret = MrisCaTrainOutputs(
        root=execution.output_file("."),
        output_file=execution.output_file(output_file),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRIS_CA_TRAIN_METADATA",
    "MrisCaTrainOutputs",
    "mris_ca_train",
]
