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

import typing
import pathlib
from styxdefs import *
import dataclasses

TRAIN_GCS_ATLAS_METADATA = Metadata(
    id="b051aeba32a674e07cb3e233df372583e269e4c4.boutiques",
    name="train-gcs-atlas",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class TrainGcsAtlasOutputs(typing.NamedTuple):
    """
    Output object returned when calling `train_gcs_atlas(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_gcs_file: OutputPathType
    """Output GCS file produced by training"""


def train_gcs_atlas(
    output_gcs: InputPathType,
    manual_parcellation: str | None = None,
    subjlist_file: InputPathType | None = None,
    hemi_spec: str | None = None,
    surf_reg: InputPathType | None = None,
    color_table: InputPathType | None = None,
    exclude_subject: str | None = None,
    jackknife_flag: bool = False,
    aseg_filename: str | None = None,
    threads: float | None = None,
    runner: Runner | None = None,
) -> TrainGcsAtlasOutputs:
    """
    Script to train a surface-based gaussian classifier for cortical surface
    parcellation.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        output_gcs: Output GCS file.
        manual_parcellation: Manual parcellation; default is aparc_edited.
        subjlist_file: File containing the list of subjects.
        hemi_spec: Specify hemisphere for processing.
        surf_reg: Surface registration file; default is sphere.reg.
        color_table: Color table file.
        exclude_subject: Exclude a subject from the atlas.
        jackknife_flag: Submit a job for each subject excluding it.
        aseg_filename: Aseg filename; default is aseg.auto.mgz.
        threads: Number of threads to use.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `TrainGcsAtlasOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(TRAIN_GCS_ATLAS_METADATA)
    cargs = []
    cargs.append("train-gcs-atlas")
    if manual_parcellation is not None:
        cargs.extend([
            "--man",
            manual_parcellation
        ])
    if subjlist_file is not None:
        cargs.extend([
            "--f",
            execution.input_file(subjlist_file)
        ])
    if hemi_spec is not None:
        cargs.extend([
            "--hemi",
            hemi_spec
        ])
    cargs.extend([
        "--o",
        execution.input_file(output_gcs)
    ])
    if surf_reg is not None:
        cargs.extend([
            "--reg",
            execution.input_file(surf_reg)
        ])
    if color_table is not None:
        cargs.extend([
            "--ctab",
            execution.input_file(color_table)
        ])
    if exclude_subject is not None:
        cargs.extend([
            "--x",
            exclude_subject
        ])
    if jackknife_flag:
        cargs.append("--jackknife")
    if aseg_filename is not None:
        cargs.extend([
            "--aseg",
            aseg_filename
        ])
    if threads is not None:
        cargs.extend([
            "--threads",
            str(threads)
        ])
    ret = TrainGcsAtlasOutputs(
        root=execution.output_file("."),
        output_gcs_file=execution.output_file(pathlib.Path(output_gcs).name),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "TRAIN_GCS_ATLAS_METADATA",
    "TrainGcsAtlasOutputs",
    "train_gcs_atlas",
]
