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

import typing
import pathlib
from styxdefs import *
import dataclasses

GCAPREPONE_METADATA = Metadata(
    id="2e14a31362a677b265992815008f70a18a14c39c.boutiques",
    name="gcaprepone",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


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


def gcaprepone(
    gcadir: str,
    subject: str,
    source_subjects_dir: str,
    done_file: str,
    init_subject: bool = False,
    no_emreg: bool = False,
    runner: Runner | None = None,
) -> GcapreponeOutputs:
    """
    Tool for preparing FreeSurfer subjects for use with group-wise template
    generation.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        gcadir: Directory to be the new SUBJECTS_DIR.
        subject: Subject for the process.
        source_subjects_dir: SUBJECTS_DIR for source data.
        done_file: File to indicate completion.
        init_subject: Flag indicating the initial subject.
        no_emreg: Flag to skip EM registration.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `GcapreponeOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(GCAPREPONE_METADATA)
    cargs = []
    cargs.append("gcaprepone")
    cargs.extend([
        "--o",
        gcadir
    ])
    cargs.extend([
        "--s",
        subject
    ])
    if init_subject:
        cargs.append("--init-subject")
    cargs.extend([
        "--sd",
        source_subjects_dir
    ])
    cargs.extend([
        "--done",
        done_file
    ])
    if no_emreg:
        cargs.append("--no-emreg")
    ret = GcapreponeOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "GCAPREPONE_METADATA",
    "GcapreponeOutputs",
    "gcaprepone",
]
